General Discussions
Convert integer to a binary word then access each bit

I have a device that sends status updates on a Modbus network. I have successfully connected to it and can access the registers. However, there is a status register that stores the system status as an integer that I need to decode into a binary word. I then need to be able to access each bit of the word to determine the system status. How can I accomplish this? I'm new to working with SCADA and this is my personal system for learning.

I have a device that sends status updates on a Modbus network. I have successfully connected to it and can access the registers. However, there is a status register that stores the system status as an integer that I need to decode into a binary word. I then need to be able to access each bit of the word to determine the system status. How can I accomplish this? I'm new to working with SCADA and this is my personal system for learning.

This is how I found to do it
1) create a numeric calculation tag
2) in the expression area put the following expression Bit([Value],x) where "value" is the register you are reading and "x" is the bit you want to examine. Remember it is zero based, so put 0 if you want the first bit and so on. If you press F1 to open the help and search for Scripts, you can find a lot of useful info like shown in the screenshot. Good luck

5e0ab90392f0d

This is how I found to do it 1) create a numeric calculation tag 2) in the expression area put the following expression Bit([Value],x) where "value" is the register you are reading and "x" is the bit you want to examine. Remember it is zero based, so put 0 if you want the first bit and so on. If you press F1 to open the help and search for Scripts, you can find a lot of useful info like shown in the screenshot. Good luck ![5e0ab90392f0d](serve/attachment&path=5e0ab90392f0d)
48
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft