Posted ByLeon on February 12, 2002 at 01:29:08:
In Reply to: Relay in CusFun. posted byPhilip on February 11, 2002 at 16:50:25:
relay #5 and #6 are single bit within the 16-bit word RELAY[1]. There are two ways to test for the bit:
1) Use the label name assigned to relay #5 and #6 (assume they are named RLY5BIT and RLY6BIT) and then use the TBASIC command:
IF TESTIO(RLY5BIT) AND TESTIO(RLY6BIT)
A = 1
ELSE A = 2
ENDIF
Another way is to use TESTBIT(RELAY[1],4) to test relay #5 and TESTBIT(RELAY[1],5) to test relay #6.
:
: I have this Cus. Fun.
: IF RELAY[5]=1 AND RELAY[6]=1
: A=1
: ELSE A=2
: ENDIF
: I want to have a=1 when relay 5 and 6 is on, but it doesn't.
: where is the error?