TESTBIT (v, n)
Purpose To return the logic state of bit #n  of the variable v. The function returns 1 if the bit is ‘1’, otherwise it returns 0.

n is an integer of value between 0 and 15. v may be any integer variable, however, if v is a 32-bit integer TESTBIT will only test the lower significant 16 bits.

Examples IF TESTBIT (Input[2],3) THEN
   ....
ELSE
   ....
ENDIF
Comments: To test whether input #20 is ON
(Input channel #2 bit #3 = Input 17 +3 = 20)
See Also SETBIT, CLRBIT

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual