beautypg.com

3 registers controlling port function – NEC switch User Manual

Page 69

background image

CHAPTER 4 PORT FUNCTIONS

User’s Manual U12978EJ3V0UD

69

4.3 Registers Controlling Port Function

The following three types of registers control the ports.

• Port mode registers (PM0, PM1, PM2, PM4)
• Pull-up resistor option register (PU0)
• Port output mode registers (POM0, POM1)

(1) Port mode registers (PM0, PM1, PM2, PM4)

These registers are used to set port input/output in 1-bit units.

The port mode registers are independently set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets registers to FFH.

When port pins are used as alternate-function pins, set the port mode register and output latch according to

Table 4-3.

Caution

As P26 can be used as an external interrupt input, when the port function output mode is

specified and the output level is changed, the interrupt request flag is set. When the

output mode is used, therefore, the interrupt mask flag should be set to 1 beforehand.

Figure 4-11. Format of Port Mode Register

PMmn

0

Output mode (output buffer on)

Input mode (output buffer off)

1

PM07

1

PM06

PM26

PM05

PM25

PM04

PM24

PM03

PM23

PM02

PM22

PM01

PM21

PM00

PM20

PM0

PM2

7

Symbol

Address

After reset

6

5

4

3

2

1

0

R/W

FF20H

FF22H

FFH

FFH

R/W

R/W

PM47 PM46 PM45 PM44 PM43 PM42 PM41 PM40

PM4

FF24H

FFH

R/W

Pmn pin input/output mode selection

PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10

PM1

FF21H

FFH

R/W