PDA

View Full Version : Why can't I make this assignment?



LGabrielson
- 18th July 2013, 21:49
Guess I've been away from PBP too long. Don't understand why I can't make this assignment:

'======================
DIPSWITCHES:
'======================
I2CREAD SDA1,SCL1,DIPSWITCH,[X] 'READ DIPSWITCH
X=X^%11111111 'INVERT
DEBUG "BIN X.BIT7=",BIN X.BIT7,13,10
RELAYBOARD = BIN X.BIT7

(I've tried declaring RELAYBOARD as a BIT and a BTYE)

Darrel Taylor
- 18th July 2013, 22:58
BIN is an output modifier for commands like SEROUT2, ARRAYWRITE, DEBUG etc.
It sends out an ASCII string representing a binary value such as 10111011, or in your case a single bit 1 or 0.
It can not be assigned to a variable.

If you just want a bit value equal to X.7, then remove the BIN modifier.

LGabrielson
- 19th July 2013, 00:27
Thanks, Darrel