Datasheet

Table Of Contents
Data Sheet ADuC832
Rev. B | Page 69 of 92
MCO
I2CM
SFR
BITS
50ns GLITCH
REJECTION FILTER
HARDWARE I
2
C
(SLAVE ONLY)
Q3
Q4
SCLOCK
PIN
Q2
Q1
(OFF)
DV
DD
SPE = 0 (I
2
C ENABLE)
02987-061
Figure 72. SCLOCK Pin I/O Functional Equivalent in I
2
C Mode
HARDWARE SPI
(MASTER/SLAVE)
Q3
Q1
Q2 (OFF)
DV
DD
SDATA/
MOSI
PIN
Q4 (OFF)
SPE = 1 (SPI ENABLE)
02987-062
Figure 73. SDATA/MOSI Pin I/O Functional Equivalent in SPI Mode
Q3
Q4
Q2
Q1
(OFF)
DV
DD
MDI
MDO
MDE
I2CM
HARDWARE I
2
C
(SLAVE ONLY)
50ns GLITCH
REJECTION FILTER
SDATA/
MOSI
PIN
SFR
BITS
SPE = 0 (I
2
C ENABLE)
02987-063
Figure 74. SDATA/MOSI Pin I/O Functional Equivalent in I
2
C Mode
MISO is shared with P3.3 and as such has the same configuration
as that shown in Figure 70.
READ-MODIFY-WRITE INSTRUCTIONS
Some 8051 instructions that read a port read the latch while
others read the pin. The instructions that read the latch rather
than the pins are the ones that read a value, possibly change it,
and then rewrite it to the latch. These are called read-modify-write
instructions. Listed below are the read-modify-write instructions.
When the destination operand is a port, or a port bit, these
instructions read the latch rather than the pin.
Instruction Description
ANL
Logical AND, for example, ANL P1, A
ORL Logical OR, for example, ORL P2, A
XRL Logical EX-OR, for example., XRL P3, A
JBC
Jump if bit = 1 and clear bit, for example, JBC
P1.1, LABEL
CPL Complement bit, for example, CPL P3.0
INC Increment, for example, INC P2
DEC Decrement, for example, DEC P2
DJNZ
Decrement and jump if not zero, for example,
DJNZ P3, LABEL
MOV PX.Y, C
1
Move carry to Bit Y of Port X
CLR PX.Y
1
Clear Bit Y of Port X
SETB PX.Y
1
Set Bit Y of Port X
1
These instructions read the port byte (all 8 bits), modify the addressed bit
and then write the new byte back to the latch.
The reason that read-modify-write instructions are directed to
the latch rather than the pin is to avoid a possible misinterpretation
of the voltage level of a pin. For example, a port pin might be
used to drive the base of a transistor. When a 1 is written to the
bit, the transistor is turned on. If the CPU then reads the same
port bit at the pin rather than the latch, it will read the base
voltage of the transistor and interpret it as a logic 0. Reading the
latch rather than the pin will return the correct value of 1.