Example

  REVERSE Pin

Function
Reverse the data direction register (TRIS) bit of the specified pin.

Explanation
REVERSE is convenient way to switch the I/O direction of a pin. If the pin is an input, REVERSE makes it an output; if it’s an output, REVERSE makes it an input.

Remember that "input" really has two meanings: (1) Setting a pin to input makes it possible to check the state (1 or 0) of external circuitry connected to that pin. The current state is in the corresponding bit of the associated port register. (2) Setting a pin to input also disconnects the output driver, possibly affecting circuitry being controlled by the pin.

  HIGH RA.3                                     ' RA.3 is output and high (1)
  PAUSE 100
  REVERSE RA.3                                  ' RA.3 is now an input

Related instructions: INPUT and OUTPUT