HIGH Pin
Make the specified Pin high. Pin is automatically made an output. Pin may be a constant, 0-15, or a variable that contains a number 0-15 (e.g. B0) or a pin name (e.g. PORTA.0).
HIGH 0 ' Make Pin0 an output and set it high (~5 volts)
HIGH PORTA.0 ' Make PORTA, pin 0 an output and set it high (~5 volts)
led Var PORTB.0 ' Define LED pin
HIGH led ' Make LED pin an output and set it high (~5 volts)
Alternatively, if the pin is already an output, a much quicker and shorter way (from a generated code standpoint) to set it high would be:
PORTB.0 = 1 ' Set PORTB pin 0 high
Since this command automatically sets the data-direction of the pin it acts on, the Pin parameter should only be a PORT or GPIO register (or an alias to a PORT or GPIO register). If the command is directed to act upon a LAT output or a bit within a variable or SFR, it will attempt to set a data-direction register that doesn't exist. The result may be unexpected behavior since a bit is changed in a seemingly random memory location. This can be very difficult to debug.
Bookmarks