OUTPUT |
OUTPUT Pin
Function
Make the specified Pin an output by writing a zero (0) to the
corresponding bit of the associated port tris register.
Explanation
There are several ways to make a pin an output. When an SX/B program is reset,
all of the I/O pins are made inputs. Instructions that rely on output pins, like
PULSOUT and SEROUT, automatically change the specified pin to output
mode. Writing 0's to particular bits of the port TRIS register makes the
corresponding pins outputs. And then there's the OUTPUT instruction:
OUTPUT RA.3 RA.3 = 0
When your program changes a pin from input to output, whatever state happens to be in the corresponding bit of port TRIS register sets the initial state of the pin. To simultaneously make a pin an output and set its state use the HIGH and LOW instructions.