Using A Sequence To Write To A Modbus Registery


ledbelly2142

Recommended Posts

I would like to use a sequence to write a value to a Modbus register. Using a component to write to a Modbus registry is straight forward, however, I would like to use an alarm that starts a sequence that changes registry values on a Modbus device.

I have tried a couple of variations of the following:

device.MyDevice.334 = 0

Watching my comm Monitor, I am not writing anything, so I have the syntax wrong. I have tried using different values for the channel number, e.g. 40334, etc..

What is the correct syntax in a sequence to write to a Modbus device registry?

Thanks

Link to comment
Share on other sites

Putting the modbus tag number in there like you did doesn't work for a number of reasons, among them the fact that the tag number alone doesn't tell DAQFactory what type of tag it is or the format of the data.

Anyhow, you have two choices:

1) create an output Modbus channel (with channel #334 in your example), then do:

myChannel = 0

2) use the direct syntax, which is something like:

device.myDevice.setRegisterFloat()

You can read more about those functions in the user's guide.

Please also note that 334 and 40334 are NOT the same modbus tag in most cases. 40334 and 333 typically are. The 40xxxx and 30xxxx notation is 1 based, not 0 based like the rest of the computer world (including the Modbus frame itself!)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.