INPUT |
INPUT Pin
Function
Make the specified Pin an input by writing a one (1) to the
corresponding bit of the associated port TRIS register.
Explanation
There are several ways to make a pin an input. When an SX/B program is reset,
all of the IO pins are made inputs. Instructions that rely on input pins, like
PULSIN and SERIN, automatically change the specified pin to input
mode. Writing 1s to particular bits of the port TRIS register makes the
corresponding pins inputs. And then there's the INPUT instruction.
Start: INPUT RA.3 Hold: IF RA.3 = 1 THEN Hold ' stay until RA.3 = 0
What happens if your program writes to a port bit of a pin that is set up as an input? The value is stored in the port register, but has no effect on the outside world. If the pin is changed to output, the last value written to the corresponding port bit will appear on the pin.