DR
AFT
DR
AFT
DRAFT
DR
D
RAFT
DRAFT
DRA
FT DRAF
D
RAFT DRAFT DRAFT DRAFT DRAFT D
DRAFT
D
RAFT DRA
FT DRAFT DRAFT DRAFT DRA
UM10316_0
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 00.06 — 17 December 2008
390 of 571
NXP Semiconductors
UM10316
Chapter 23: LPC2xx I2C-interface
The contents of the I
2
C control register may be read as I2CONSET. Writing to I2CONSET
will set bits in the I
2
C control register that correspond to ones in the value written.
Conversely, writing to I2CONCLR will clear bits in the I
2
C control register that correspond
to ones in the value written.
7.9 Status decoder and status register
The status decoder takes all of the internal status bits and compresses them into a 5 bit
code. This code is unique for each I
2
C bus status. The 5 bit code may be used to generate
vector addresses for fast processing of the various service routines. Each service routine
processes a particular bus status. There are 26 possible bus states if all four modes of the
I
2
C block are used. The 5 bit status code is latched into the five most significant bits of the
status register when the serial interrupt flag is set (by hardware) and remains stable until
the interrupt flag is cleared by software. The three least significant bits of the status
register are always zero. If the status code is used as a vector to service routines, then the
routines are displaced by eight address locations. Eight bytes of code is sufficient for most
of the service routines (see the software example in this section).
8.
Register description
Each I
2
C interface contains 7 registers as shown in
below.
Table 322. I
2
C register map (base address 0xE008 2000 (I2C0) and 0xE008 3000 (I2C1))
Generic
Name
Description
Access
Reset
value
I
2
Cn Register
Name & Address
I2CONSET
I2C Control Set Register.
When a one is written to a
bit of this register, the corresponding bit in the I
2
C
control register is set. Writing a zero has no effect on
the corresponding bit in the I
2
C control register.
R/W
0x00
I2C0CONSET - 0xE008 2000
I2C1CONSET - 0xE008 3000
I2STAT
I2C Status Register.
During I
2
C operation, this
register provides detailed status codes that allow
software to determine the next action needed.
RO
0xF8
I2C0STAT - 0xE008 2004
I2C1STAT - 0xE008 3004
I2DAT
I2C Data Register.
During master or slave transmit
mode, data to be transmitted is written to this register.
During master or slave receive mode, data that has
been received may be read from this register.
R/W
0x00
I2C0DAT - 0xE008 2008
I2C1DAT - 0xE008 3008
I2ADR
I2C Slave Address Register.
Contains the 7 bit slave
address for operation of the I
2
C interface in slave
mode, and is not used in master mode. The least
significant bit determines whether a slave responds to
the general call address.
R/W
0x00
I2C0ADR - 0xE008 200C
I2C1ADR - 0xE008 300C
I2SCLH
SCH Duty Cycle Register High Half Word.
Determines the high time of the I
2
C clock.
R/W
0x04
I2C0SCLH - 0xE008 2010
I2C1SCLH - 0xE008 3010
I2SCLL
SCL Duty Cycle Register Low Half Word.
Determines the low time of the I
2
C clock. I2nSCLL
and I2nSCLH together determine the clock frequency
generated by an I
2
C master and certain times used in
slave mode.
R/W
0x04
I2C0SCLL - 0xE008 2014
I2C1SCLL - 0xE008 3014