![](http://datasheet.mmic.net.cn/370000/UPD17120_datasheet_16743697/UPD17120_123.png)
CHAPTER 12 PORTS
108
12.4 PORT 0C (P0C
0
/Cin
0
, P0C
1
/Cin
1
, P0C
2
/Cin
2
, P0C
3
/Cin
3
)
... in the case of the
μ
PD17132, 17133, 17P132, and 17P133
Port 0C is a 4-bit input/output port with an output latch. It is mapped into address 72H of BANK0 in data memory.
The output format is CMOS push-pull output.
Input or output can be specified bit-by-bit. Input/output is specified with P0CBIO0 to P0CBIO3 (address 34H) in
the register file.
If P0CNIOn is 0 (n=0 to 3), the each pin of P0C is used as input port. If a data read instruction is executed for
the port register, the pin statuses are read.
If P0CNIOn is 1 (n=0 to 3), the each pin of P0C is used as output port and the value written in the output latch
are output to pins. If a data read instruction is executed when pins are used as output ports, the output latch value,
rather than pin statuses, is fetched.
Port 0C can also be used as an analog input to the comparator. P0C0IDI to P0C3IDI (address 23H) in the register
file are used to switch the port and analog input pin.
If P0CnIDI is 0 (n=0 to 3), the P0C
n
/Cin
n
pin functions as a port. If P0CnIDI is 1 (n=0 to 3), the P0C
n
/Cin
n
pin functions
as the analog input pin of the comparator.
Therefore, when using pins as analog inputs, 1 should be set to P0CnIDI at the initial setting of the program.
Switching of the analog input pins to be compared is executed by CMPCH0 and CMPCH1 (RF: address 1CH). To
use the pins as analog input pins of the comparator, set P0CBIOn=0 so that they are set as input ports (Refer to
13.2 COMPARATOR
). At reset, P0CBIOn and P0CnIDI are set to 0 (n=0 to 3) and all of port 0C pins become input
ports. The contents of the port output latch become 0.
Table 12-4. Writing into and Reading from the Port Register (0.72H) and Pin Function Selection
(n=0 to 3)
BANK0 72H
Write
Read
0
Input port
Pin state of P0C
1
Output port
Contents of P0C latch
0
Comparator analog
input
Note 1
1
Analog inputs of
comparator and output
port
Note 2
Contents of P0C
Notes
1.
This setting is ordinally selected when the pins are used as analog inputs of the comparator.
2.
These pins function as an output port. At this time, the analog input voltage is changed by the effect
of the output from the port. When using the pin as the analog input, be sure to set it to P0CBIOn=0.
Pin state of P0C
Write in the P0C latch
Function
P0CnIDI
RF: 23H
P0CBIOn
RF: 34H
0
1