Controlling and Resetting the Port
10-16
When pins IO0–IO3 are configured as inputs
When pins IO0–IO3 are configured as inputs, the eight LSBs of the IOSR allow
you to monitor these four pins. Each of the IOSR bits 3–0, called IO3, IO2, IO1,
and IO0, can be used to read the current logic level (high or low) of the signal
at the corresponding pin. Each of the bits 7–4, called DIO3, DIO2, DIO1, and
DIO0, is used to track a change from a previous known or unknown signal val-
ue at the corresponding pin. When a change is detected on one of the pins,
the corresponding detect bit is set to 1, and an interrupt request is sent to the
CPU on the TXRXINT interrupt line. You can clear each of the detect bits to
0 by writing a 1 to it. DIO3–DIO0 are only useful when the pins are configured
as inputs and the serial port is enabled by the URST bit of the ASPCR
(URST = 1). Table 10–4 summarizes what IOSR bits 0–7 indicate when IO0–
IO3 are inputs.
Table 10–4. Viewing the Status of Pins IO0–IO3 With IOSR Bits IO0–IO3 and DIO0–DIO3
IOSR Bit
Number
IOSR Bit
Name
When IO0–IO3 are inputs,
this bit indicates...
0 IO0 Current logic level (0 or 1) on pin IO0
1 IO1 Current logic level (0 or 1) on pin IO1
2 IO2 Current logic level (0 or 1) on pin IO2
3 IO3 Current logic level (0 or 1) on pin IO3
4 DIO0
†
Change detected (1) or not detected (0)
on pin IO0 (when IO0 is an input)
5 DIO1
†
Change detected (1) or not detected (0)
on pin IO1 (when IO1 is an input)
6 DIO2
†
Change detected (1) or not detected (0)
on pin IO2 (when IO2 is an input)
7 DIO3
†
Change detected (1) or not detected (0)
on pin IO3 (when IO3 is an input)
†
Write a 1 to this bit to clear it to 0.
When pins IO0–IO3 are configured as outputs
When pins IO0–IO3 are configured as outputs, you can write to the four LSBs
(IO3–IO0) of the IOSR. The value you write to each bit becomes the new logic
level at the corresponding pin. For example, if you write a 0 to bit 2, the logic
level at pin IO2 changes to low; if you write a 1 to bit 2, the logic level on IO2
changes to high.