
W79E804A/803A/802A
Publication Release Date: July 16, 2007
- 95 -
Revision A2
24. I2C SERIAL CONTROL
The I2C bus uses two wires (SDA and SCL) to transfer information between devices connected to the
bus. The main features of the bus are:
– Bidirectional data transfer between masters and slaves
– Multimaster bus (no central master)
– Arbitration between simultaneously transmitting masters without corruption of serial data on the bus
– Serial clock synchronization allows devices with different bit rates to communicate via one serial bus
– Serial clock synchronization can be used as a handshake mechanism to suspend and resume serial
transfer
–
The I2C bus may be used for test and diagnostic purposes
–
t
BUF
STOP
SDA
SCL
START
t
HD;STA
t
LOW
t
HD;DAT
t
HIGH
t
f
t
SU;DAT
Repeated
START
t
SU;STA
t
SU;STO
STOP
t
r
Figure
24-1: I2C Bus Timing
The device’s on-chip I2C logic provides the serial interface that meets the I2C bus standard mode
specification. The I2C logic handles bytes transfer autonomously. It also keeps track of serial
transfers, and a status register (I2STATUS) reflects the status of the I2C bus.
The I2C port, SCL and SDA are at P1.2 and P1.3. When the I/O pins are used as I2C port, user must
set the pins to logic high in advance. When I2C port is enabled by setting ENS to high, the internal
states will be controlled by I2CON and I2C logic hardware. Once a new status code is generated and
stored in I2STATUS, the I2C interrupt flag (SI) will be set automatically. If both EA and EI2C are also
in logic high, the I2C interrupt is requested. The 5 most significant bits of I2STATUS stores the internal
state code, the lowest 3 bits are always zero and the content keeps stable until SI is cleared by
software.
24.1 SIO Port
The SIO port is a serial I/O port, which supports all transfer modes from and to the I2C bus. The SIO
port handles byte transfers autonomously. To enable this port, the bit ENS1 in I2CON should be set to
'1'. The CPU interfaces to the SIO port through the following six special function registers:
I2CON
(control register, C0H),
I2STATUS
(status register, BDH),
I2DAT
(data register, BCH),
I2ADDR
(address registers, C1H),
I2CLK
(clock rate register BEH) and
I2TIMER
(Timer counter register, BFH).
The SIO H/W interfaces to the I2C bus via two pins: SDA (P1.3, serial data line) and SCL (P1.2, serial
clock line). Pull up resistors are needed for Pin P1.2 and P1.3 for I2C operation as these are open
drain pins.