STC8A8K64D4 Series Manual
9.2 Configure I/O Ports
Two registers are used to configure each I/O mode.
Taking Port 0 as an example, two registers, P0M0 and P0M1, are used to configure Port 0, as shown in the following
figure:
The combination of bit 0 of P0M0 and bit 0 of P0M1 is used to configure the mode of P0.0.
The combination of bit 1 of P0M0 and bit 1 of P0M1 is used to configure the mode of P0.1.
All other I/O lines configuration method is similar.
The combination of PnM0 and PnM1 to configure the I/O ports mode is as following.
PnM1
PnM0
0
0
0
1
1
0
1
1
Note:
Any I/O port line can tolerate 20mA of sink current in weak pull-up mode (quasi-bidirectional mode) or strong push-pull output
mode or open drain mode, and can output 20mA pull current in the strong push-pull output mode. Current limiting resistors should
be connected in all I/O mode above, such as 1KΩ, 560Ω, 472Ω, etc.
to exceed 70mA, that is, the current flowing in from Vcc is not recommended to exceed 70mA, the current flowing from Gnd is not
to exceed 70mA, and the overall current flowing in/out of it is not recommended to exceed 70mA.
9.3 I/O Ports Structure
9.3.1 Quasi-Bidirectional I/O (weak pull-up)
A quasi bidirectional port can be used as an input and output functions without the need to reconfigure the port. This is
because the drive capability is weak when the port outputs a logic high level, allowing external devices to pull it low. When
the pin outputs low, it has strong driving capability and able to sink a considerable current. There are three pull-up transistors
in the quasi-bidirectional output to adapt different needs.
One of the three pull-up transistors, called "weak pull-up", is turned on when the port register is logic "1" and the pin
itself is logic "1". This pull-up transistor provides the basic drive current to make the quasi-bidirectional port output logic "1".
P0.7
Configure
Configure
P0M0
7
6
P0M1
7
6
P0.6
Configure
Quasi bidirectional (traditional 8051 I/O port, weak pull-up)
Sink Current up to 20mA , Pull-up Current is 270~150μA (manufacturing error may be exist)
Push-pull output (strong pull-up output, current can be up to 20mA, resistors should be used to
limit current)
high-impedance
(where current can neither flow in nor out)
Open Drain mode. The internal pull-up resistors are disabled. The open drain mode can be used for
both external status reading and output high or low. To read the external state correctly or output
high level, the external pull-up resistors should be connected, otherwise the external state can not
be read and the high level can not be output.
Note: n
P0.5
P0.3
Configure
Configure
5
4
3
2
5
4
3
2
P0.4
P0.2
Configure
Configure
I/O ports Mode
= 0,1,2,3,4,5,6,7
But the working current of the whole chip is recommended not
-
P0.1
1
0
1
0
P0.0
Configure
- 168 -
Need help?
Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?