if output is high then...

Screech

Member
I UNDERSTAND THAT IF/THEN COMMANDS ARE USED FOR INPUTS BUT, 'BL**DY capitals!
can I use the "if / then" for an output?


eg.

START :
if output 2 is low then goto MAIN
goto START

MAIN:
HIGH 2

'THANKS


 

hippy

Ex-Staff (retired)
You have to get the current output pin state into a variable and then extract the bit required and use an IF on that. The current output pin states can be got by "PEEK $30,var" Using b0 or b1 is easiest as it gives access to the individual bits through the bitX variables.

To do something when output 2 is low ...

- PEEK $30,b0
- IF bit2 = 0 THEN DoIt

- PEEK $30,b1
- IF bit10 = 0 THEN DoIt

- PEEK $30,b2
- b2 = b2 & %00000100
- IF b2 = 0 THEN DoIt
 
Top