AnsweredAssumed Answered

Is it possible to convert a long integer value to binary in PI and then select a bit down from the binary string and display it as a digital set?

Question asked by Kwhite120917 on Feb 22, 2020
Latest reply on Feb 24, 2020 by Rick_Davin_3.0

Is it possible to perform an analysis that converts a long integer(32 bits) value to binary in PI and then select a bit down from the binary string and display it as a digital set(Boolean)?

 

Ex. Value_Tag = 34

 34 in Binary = 10010

and I want to look at bit 2 (second bit from the right) as a status bit of “open” or ”closed”

1 = open and 0 = closed

so with the Long integer value of 34 that bit will display ”open” but if we change the long integer value to 33 for example it would display “closed“

Outcomes