9 port a, 9-1 description – Panasonic MN101C77C User Manual

Page 191

Advertising
background image

IV - 41

Chapter 4 I/O Ports

Port A

4-

9 Port A

4-

9-1 Description

„

General Port Setup

Each bit of the port A control I/O direction register (PADIR) can be set individually to set each pin as input

or output. The control flag of the port A direction control register (PADIR) should be set to "1" for output

mode, and "0" for input mode.

To read input data of pin, set the control flag of the port A direction control register (PADIR) to "0" and read

the value of the port 0 input register (P0IN).

To output data to pin, set the control flag of the port A direction control register (P0DIR) to "!" and write the

value of the port 0 output register (P0OUT).

Each bit can be set individually whether pull-up / pull-down resistor is added or not, by the port A pull-up /

pull-down resistor control register (PAPLUD). Set the control flag of the port A pull-up / pull-down resistor

control register (PAPLUD) to "1" to add pull-up or pull-down resistor. The pull-up / pull-down resistor selec-

tion register (FLOAT) select if pull-up resistor or pull-down resistor is added. The bp6 of the pull-up / pull-

down resistor control register (FLOAT) is set to "1" for pull-down resistor, set to "0" for pull-up resistor.

„

Special Function Pin Setup

PA0 to PA6 are used as input pins for analog. Each bit can be set individually as an input by the port A

input mode register (PAIMD). When they are used as analog input pins, set the port A input mode

register (PAIMD) to "1". Then, the value of the port A input register (PAIN) is read out "0".

By setting the control flag of the PAIMD register to "1", the through current is not occurred

when input voltage is at intermediate level.

PA0 to PA1 is used as DA output pin, as well. By the setting of DA control register (DACTR), PA0 to PA1

can be used as DA0, DA1 output pin during DA converting. As for the rest, PA0 to PA1 can be used as

general port. During DA converting, the port A input register (PAIN) indicates "1".

To prevent the through current, add the pull-up resistor when PA0 to PA1 are used as output

pin for DA and analog output is not used.

Advertising
This manual is related to the following products: