beautypg.com

NEC PD17062 User Manual

Page 196

background image

196

µ

PD17062

15.3.4 To Use an I/O Port (P0A, P0B, P1B, P1C) as an Input Port

Select the pin to be used as an input port by using the I/O selection register of each port.

P1C can be set to I/O in 3-bit (3-pin) units only.

The pin specified as an input port enters floating (Hi-Z) status and waits for the input of an external signal.

Input data can be read by executing an instruction to read the contents of the port register for each pin,

for example, the SKT instruction.

When a high level signal is input to each pin of the port register, 1 is read. When a low level signal is input

to each pin of the port register, 0 is read.

Upon the execution of an instruction, such as the MOV instruction, to write to the port register specified

as an input port, the contents of the output latch are overwritten.

15.3.5 To Use an I/O Port (P0A, P0B, P1B, P1C) as an Output Port

Select the pin to be used as an output port by using the I/O selection register of each port.

P1C can be set to I/O in 3-bit (3-pin) units only.

The pin specified as an output port outputs the contents of the output latch from each pin.

Output data can be set by executing an instruction to write the contents of the port register for each pin,

for example, the MOV instruction.

To output a high level signal to each pin, write 1. To output a low level signal to each pin, write 0.

The pin can be set to the floating state (Hi-Z) by specifying it as an input port.

Upon executing an instruction, such as the SKT instruction, for reading the port register specified as an

output port, the contents of the output latch are read.

Note, however, that the contents of the output latch and the read contents may differ because the two pins,

P0A

1

and P0A

0

, are read without changing the pin state.

See Section 15.3.6.