2.2.3 Use in High-Level Commands
The data-direction is set automatically for most of the PBP high-level commands. If the command sends output, the pin is set for output. If the command reads the digital state of the pin, the pin will be set to input. PBP does not set the data-direction back to its original state after such commands are executed.
Either the PORT.PIN designations or the aliases you have assigned may be used directly in PBP commands. For instance, there is no need to read a pin value to a variable before testing it. You can test an input pin directly with:
IF switch = 0 THEN ' Check state of switch pin
HIGH led1 ' LED on
PAUSE 500 ' Delay 500mS
LOW led1 ' LED off
ENDIF
I2CREAD PORTB.5, PORTB.4, $A0, location,[B_val]
Note the use of the HIGH and LOW commands in the preceding example. These are considered high-level commands
because they do more than just set the bit in the PORTx register. They also set the data-direction to output.
Bookmarks