English
Language : 

W921E840A Datasheet, PDF (17/58 Pages) Winbond – 4-BIT MICROCONTROLLER
W921E840A/W921C840
6.5 Input/Output
There are 34 I/O pins including 4 large sink current pins in this chip. All the I/O pins will remain in the
input mode after power on reset.
The I/O instructions are described as follows:
MOV
MOV
MOV
MOV
A, Px
B, Px
Px, A
Px, B
Input port x to A accumulator
Input port x to B accumulator
Output A accumulator data to port x.
Output B accumulator data to port x.
The input or output status of port 2 to port 6 can be pin controlled by port mode register (PMx, where
x = 2 to 6). Data 0 of PMx indicates the corresponding pin as output mode, and data 1 indicates the
relative pin as input mode. For example, MOV PM2, #0101B, it sets P2.0 and P2.2 in input mode and
P2.1 and P2.3 in output mode. The I/O instructions don't affect the I/O status in Port 2 to Port 6.
The input or output mode of port A to port D only can be decided by I/O instructions. For example,
MOV A, Px will change Px to input mode and MOV Px, A will change it to output mode.
6.5.1 Normal/Special Function Selection of I/O
Some of the I/O ports can be programmed to special function via special control register. The detail
functions are as follows:
• P2.0 to P2.3: Four 15mA sink current normal I/O pins only
• P3.0 to P3.3: Multi-function I/O pins (selected by P3IO register)
− Normal function I/O pins
− Special function input pins
P3IO register: (address = 00FH, default data = 0H)
b3
b2
b1
b0
0: Normal I/O P3.0
1: Analog input pin 0 (ANI0)
0: Normal I/O P3.1
1: Analog input pin 1 (ANI1)
0: Normal I/O P3.2
1: Analog input pin 2 (ANI2)
0: Normal I/O P3.3
1: Analog input pin 3 (ANI3)
- 17 -
Publication Release Date: July 1999
Revision A3