2 port 1 analog functions, 3 port read-modify-write, Figure 13-5 – Rainbow Electronics AT89LP216 User Manual
Page 25
25
3621A–MICRO–6/06
AT89LP216 [Preliminary]
Figure 13-5. Push-pull Output
13.2
Port 1 Analog Functions
The AT89LP216 incorporates an analog comparator. In order to give the best analog perfor-
mance and minimize power consumption, pins that are being used for analog functions must
have both their digital outputs and digital inputs disabled. Digital outputs are disabled by putting
the port pins into the input-only mode as described in
“Port Configuration” on page 22
. Digital
inputs on P1.0 and P1.1 are disabled whenever the Analog Comparator is enabled by setting the
CEN bit in ACSR. CEN forces the PWD input on P1.0 and P1.1 low, thereby disabling the
Schmitt trigger circuitry. P1.0 and P1.1 will always default to input-only mode after reset regard-
less of the state of the Tristate-Port Fuse.
13.3
Port Read-Modify-Write
A read from a port will read either the state of the pins or the state of the port register depending
on which instruction is used. Simple read instructions will always access the port pins directly.
Read-modify-write instructions, which read a value, possibly modify it, and then write it back, will
always access the port register. This includes bit write instructions such as CLR or SETB as they
actually read the entire port, modify a single bit, then write the data back to the entire port. See
for a complete list of Read-Modify-Write instruction which may access the ports.
Port
Pin
V
CC
From Port
Register
Input
Data
PWD
Table 13-3.
Port Read-Modify-Write Instructions
Mnemonic
Instruction
Example
ANL
Logical AND
ANL P1, A
ORL
Logical OR
ORL P1, A
XRL
Logical EX-OR
XRL P1, A
JBC
Jump if bit set and clear bit
JBC P3.0, LABEL
CPL
Complement bit
CPL P3.1
INC
Increment
INC P1
DEC
Decrement
DEC P3
DJNZ
Decrement and jump if not zero
DJNZ P3, LABEL
MOV PX.Y, C
Move carry to bit Y of Port X
MOV P1.0, C
CLR PX.Y
Clear bit Y of Port X
CLR P1.1
SETB PX.Y
Set bit Y of Port X
SETB P3.2