GetBit is a built-in scripting function that gets the value of a single bit in a numeric value.
Function | Group | Execution | Windows | Embedded | Thin Client |
---|---|---|---|---|---|
GetBit | Arithmetic | Synchronous | Supported | Supported | Supported |
GetBit( tagName, numBitNumber )
Returns the value ( 0 or 1 ) of the specified bit.
You also can use the Bit field to read/write values from specific bits in an integer tag. For example, enter Second->b0 to access the LSB (Least Significant Bit of the Second tag), and Second->b31 to access the MSB (Most Significant Bit of the Second tag).
Tag Name | Expression |
---|---|
Tag | GetBit( "numSource", 4 ) // If the tag numSource holds a value of 15, then this function returns 0. |
Tag | GetBit( "numSource", 1 ) // If the tag numSource holds a value of 19, then this function returns 1. |