When using the IF..Then statement how many comparison terms can you have? Is the following a legal instruction:
IF (PORTA.0 = 1 AND PORTA.1 = 1) OR (PORTA.2 = 1) THEN PORTB.0 = 1
Any help would be appreciated
thank you,
Shawn
When using the IF..Then statement how many comparison terms can you have? Is the following a legal instruction:
IF (PORTA.0 = 1 AND PORTA.1 = 1) OR (PORTA.2 = 1) THEN PORTB.0 = 1
Any help would be appreciated
thank you,
Shawn
No, your line is not legal. Replace it by
IF (PORTA.0=1) AND (PORTA.1=1) THEN PORTB.0=1
IF PORTA.2=1 THEN PORTB.0=1
Robert
Last edited by rsocor01; - 11th November 2009 at 00:35.
Or...
If ((porta.0 = 1) and (porta.1 = 1)) or (porta.2 = 1) then portb.0 = 1
___________________
WHY things get boring when they work just fine?
Since the three inputs are all on the same port, then you can tray:
A0 var BYTE
A0 = PortA.0 + PortA.1 + PortA.2
If A0 > 2 then PortB.0 = 1
or.....
IF PortA & %00000111 > 2 then portB.0 = 1
Al.
Last edited by aratti; - 11th November 2009 at 01:07.
All progress began with an idea
Bookmarks