beautypg.com

2 functions of general-purpose ports – NEC PD17062 User Manual

Page 191

background image

191

µ

PD17062

b

3

b

2

b

1

b

0

m

n

P
P
P
P

3

2

1

0

Weight of port register bit
Port register address (Examples: 70H = A, 71H = B, 72H = C, 73H = D)
Port register bank
"P" of port

Port register

Bank

Address

Bit

15.2 FUNCTIONS OF GENERAL-PURPOSE PORTS

A general-purpose I/O port, set up either as a general-purpose output port or output port, outputs high level

or low level signals from each corresponding pin by setting data in the port register accordingly.

A general-purpose I/O port, set up either as a general-purpose input port or input port, detects the level

of the input signal applied to each corresponding pin by reading the contents of the port register.

General-purpose I/O ports are set either as an input ports or output ports, according to the contents of the

control register for each port.

This enables I/O switching to be done by the program.

Since P0A to P0D and P1A to P1C are set as general-purpose ports at power-on reset, other pins that are

used as peripheral hardware are set up independently according to the contents of the corresponding control

register.

Sections 15.2.1 to 15.2.4 describe the functions of the port register and outline the functions of each port.

15.2.1 General-Purpose Port Data Register (Port Register)

The port register sets output data for each general-purpose port and reads input data.

Since the port register is mapped into data memory, it can be manipulated by all data memory manipulation

instructions.

Fig. 15-2 shows the relationship between the port register and each corresponding pin.

Output for each pin is set by setting data in the port register for the pin set as a general-purpose output

port.

The input state of each pin is detected by reading the contents of the port register for the pin set as a general-

purpose output port.

Table 15-2 shows the relationship between each port (each pin) and the port register.

Fig. 15-2 Relationship Between Port Register and Each Pin

Reserved words are defined in the port register by the assembler.

Since reserved words are defined in flag units (bits), the assembler built-in macro instructions can be used.

Note that reserved words of data memory type are not defined in the port register.