Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

getting bits of alarm word

I have a MODBUS alarm word. Each bit corresponds to a specific alarm. How can I write and expression to generate a logical indicator for each alarm. I do not want to define each alarm in the data member since this chews up tons of IO points
0 Kudos
Message 1 of 2
(3,315 Views)
Lookout doesn't have bitwise operators, so it's a little complex to get each bit.
Assume X is the word(16 bit unsigned int), you can get each bit by following expressions
 
X>=32768         most significant bit
mod(X, 32768)>=16384
mod(X, 16384)>=8192
......
mod(X, 2)>=1   least significant bit
 
The output is true or false.
Ryan Shi
National Instruments
0 Kudos
Message 2 of 2
(3,307 Views)