Modbus Register And Bit Value


Recommended Posts

I have a modbus registry value that is the status of 5 relays in bit representation... the bit values indicate the on/off stat of the relays in order (e.g. 1, 2, 3, 4 ,5).

The variable value component reads the binary notation and converts it into a number, which I think is normal. So when some of the relays are on, I get a value of "9".

How can I display the registry value in bit representation, and how can I make it useable for logging relay run time?

I would like to log relay 1 runtime, relay 2 runtime, etc...


Link to comment
Share on other sites

I'm not doing something right. The bits are not accurate and some are -0...

Here is what I have in the channel (channel=RelayStatus) event:

private bits = to.Bit(RelayStatus[0])






I am think that the second [0] in the Relay.addvalue lines identifies the bit (sequentially) in the registry value. But I also thought that using [0][0] together was identifying a two dimensional array.


Link to comment
Share on other sites

Just reread the documentation, the bit order is from the LSB (least significant bit)... so the first relay (I think) should be



but this does not work either. I have some formatting issue, the bit values seem random with -1, -0, 0, and 1.

Link to comment
Share on other sites


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