DIR command
Armored Cars
Posts: 172
Can DIR be used as a contant or variable such as in these examples?
(Assume that DIRA is less than 255)
IF DIR20=1 GOTO test
LOOKUP DIRA [noparse]/noparse
(Assume that DIRA is less than 255)
IF DIR20=1 GOTO test
LOOKUP DIRA [noparse]/noparse
Comments
IF (IN20 = 1) THEN Test
LOOKUP INA, [noparse][[/noparse] ... ], result
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
If so, I'm not sure you can use the DIRxx variables that way. In 'native PIC' you could, but I don't think PBasic supports that. Note the INPUT/OUTPUT state of a pin is changed by several instructions. SEROUT will automatically make a pin an output before use. HIGH or LOW will make it an output. INPUT MyPin will obviously make it an input.
The easiest solution to this would be to keep a local WORD variable, update it with what you *want* the states to be, then assign that variable to the DIR register to update them, and read your local variable for the state.