beautypg.com

4. port 7 led2 control, 4-1. port 7 registers – Oki JOB60851 User Manual

Page 58

background image

Chapter 4 Software Development

page 4-23

4-4. Port 7 LED2 Control

The MSM66Q573 microcontroller on the JOB60851 board has twelve bidirectional ports (P0 to P11)
with 75 pins and an input only port (P12).

The Section describes the use of Port 7 (P7), the one connected to LED2.

4-4-1.

Port 7 Registers

Each MSM66Q573 microcontroller port on the JOB60851 board has at least three control registers.
The following describes those for Port 7.

(1) Port Mode Register (P7IO)

The bits in this register control the I/O directions of the corresponding Port 7 pins: input ("0") or
output ("1"). After a reset, this register contains 00H, configuring all pins for input.

Port Mode Register (P7IO)

Bit number

bit7

bit6

bit5

bit4

bit3

bit2

bit1

bit0

P7IO

P7IO7

P7IO6

P7IO5

P7IO4

---

P7IO2

P7IO1

P7IO0

After a reset

0

0

0

0

---

0

0

0

Setting a bit to "0" configures the corresponding Port 7 pin for input; "1" is for output.

(2) Port Secondary Function Control Register (P7SF)

The bits in this register switch between the primary ("0") and secondary ("1") functions of the
corresponding Port 7 pins. After a reset, this register contains 00H, configuring all pins for their
primary functions.

Port Secondary Function Control Register (P7SF)

Bit number

bit7

bit6

bit5

bit4

bit3

bit2

bit1

bit0

Primary

PWM1

OUT

PWM2

OUT

---

PTM3

OUT

---

---

TXD0

---

P7SF

Secondary

P7SF7

P7SF6

P7SF5

P7SF4

---

P7SF2

P7SF1

P7SF0

After a reset

0

0

0

0

---

0

0

0

Setting a bit to "0" configures the corresponding Port 7 pin for its primary function; "1" is for its
secondary function.

Note that bit 0 has no secondary function because the corresponding pin is always a serial port
receive data pin. To enable this input pin, simply write "0" to bit 0 in the Port Mode Register
(P7IO).

(3) Data Port Register (P7)

The bits in this register hold the port's I/O data. After a reset, this register contains 00H.

Reading this register yields the input states of pins configured for input and the last data written
for pins configured for output.

Writing to this register overwrites all bits regardless of pin I/O directions.