I am reading out a uint16 value in Modbus from a Status Word for a wind turbine setup.
This value records the alarm on.off state of various parameters (overspeed/wind excessive/overcurrent etc)
I need to read the first (lsb) 8 bits of this uint16 holding register and depending on their individual state (1 or 0 obviously) use this to present the alarm state.
So - for instance:
0000000000000001 would equate to Brake_Status = ON
0000000000000010 would equate to Run_Status = ON
etc for bits 0 - 7
It is possible to have more than one active at a time. So I cant just read out an integer value (2,4,8,16,etc) for the state. I need to extract the binary bit value for each of these first 8 bits and name each bit, give it a unique ID and then read it’s 1 or 0 state as a coil type status. These will then be used on the UI probably as a red/green LED type output.
Can anyone give me some hints as the best way to structure this please?
I can pull out the basic integer value using this: