📖⚡IF PORTA

Same as normal IF statement, except that all pin references now refer to the PORTA input port.

When using this command ALL pin references are to the PORTA port - you cannot mix default input and PORTA input pins in a single statement.

See 📖⚡IF for more details about IF construction.

todo:

Tutorials: Simple Logic Comparing Values

Syntax

IF PORTA Condition THEN

  COMMANDS 

ENDIF


' IF PORTA Example
' IfPortA.txt
' Select Kic40 for this to compile

DO

  ' Test PORTA pin 1
  IF PORTA PIN0 = 1 THEN

    ' Turn on PORTC pin 0
    HIGH PORTC 0

    PAUSE 100

  ENDIF
LOOP

If you need to combine PORTA inputs with default input port then use a nested IF statement like this example:

' Combining PORTA with default inputs Example
' PORTA_AND_DEFAULT.TXT
' Select Kic28 for this to compile

DO
  ' Test PORTA inputs
  IF PORTA PIN0 = 1 THEN

    ' Test Default inputs
    IF PIN0 = 1 THEN

      HIGH PORTC 0
      PAUSE 100

    ENDIF

  ENDIF
LOOP

Related Commands:

todo: Tutorials: Simple Logic