Need some help with BS2 syntax - IF...THEN
Otaku1031
Posts: 34
Hi all,
I'm having some difficulty with getting this sequence to work:
I'm using pin 12 as an input for a logic signal from a CD4070 gate. I need to look at this signal, determine if it's 0 or 1, and take the appropriate action. If the signal is 1 (indicating a test failure) I want to make pin 13 high to turn on an LED. Here's what the code looks like right now:
IF IN12 = 1 THEN OUT13 = 1
END IF
When I check syntax, I keep getting errror msg's like "Expected: Label". I've been using Excel VBA for > 10 years, but this is my first exposure to PBASIC. I can't seem to find a code example anywhere that shows how to turn a pin ON based on the input (high/low) to a different pin. I have pin 12 defined as an input and 13 defined as an output. Can anyone point me in the right direction? Many thanks!
Gary
I'm having some difficulty with getting this sequence to work:
I'm using pin 12 as an input for a logic signal from a CD4070 gate. I need to look at this signal, determine if it's 0 or 1, and take the appropriate action. If the signal is 1 (indicating a test failure) I want to make pin 13 high to turn on an LED. Here's what the code looks like right now:
IF IN12 = 1 THEN OUT13 = 1
END IF
When I check syntax, I keep getting errror msg's like "Expected: Label". I've been using Excel VBA for > 10 years, but this is my first exposure to PBASIC. I can't seem to find a code example anywhere that shows how to turn a pin ON based on the input (high/low) to a different pin. I have pin 12 defined as an input and 13 defined as an output. Can anyone point me in the right direction? Many thanks!
Gary
Comments
Also, ENDIF is one word.
Rich H
IF IN12 = 1 THEN Fail_LED
END
Fail_LED:
HIGH 13
END
I may stick with this, as I'll need to reference Fail_LED several times in this program. I'll test your suggestion first thing when I get back to work. Thanks again!
This needs an ENDIF;
This does not need an ENDIF;
Rich H