Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Read MODBUS controller register from script without tags
PostPosted: Wed Jan 29, 2014 3:30 am 

Joined: Mon Jan 27, 2014 4:41 am
Posts: 2

Offline
Hello,
our application needs to read multiple modbus address pools from different modbus slave controllers.

Due to that it is very hard to instance hundreds of tags and then use huges "switch-cases" structures to parse them since we need to "switch the contest" among the devices from the same screen without using a screen for each controller.
The question is:
Is there any way to index a specific modbus address (for read/write) from scripting?
We need to do something like a baseaddress+offset indirect addressing.

thanks very much.


 Profile  
 
 Post subject: Re: Read MODBUS controller register from script without tags
PostPosted: Fri Apr 25, 2014 3:40 pm 

Joined: Thu Jun 06, 2013 9:21 am
Posts: 61

Offline
Code:
public void SetTag(string tagName, VariantValue val) {

         // Use reflection to find everything about Tags class in memory
         Type tagType = Globals.Tags.GetType();
         // Must have an instance in memory to write to otherwise it cannot write to a class directly
         var tag = (GlobalDataItem)tagType.GetProperty( tagName ).GetValue(Globals.Tags, null);
         tag.Value = val;

      }

      void Button_Click(System.Object sender, System.EventArgs e)
      {

         SetTag("Tag1", 5);
      }


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: