![NXP Semiconductors LPC29 Series Скачать руководство пользователя страница 400](http://html1.mh-extra.com/html/nxp-semiconductors/lpc29-series/lpc29-series_user-manual_1721826400.webp)
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
400 of 571
NXP Semiconductors
UM10316
Chapter 23: LPC2xx I2C-interface
The I
2
C rate must also be configured in the I2SCLL and I2SCLH registers. I2EN must be
set to logic 1 to enable the I
2
C block. If the AA bit is reset, the I
2
C block will not
acknowledge its own slave address or the general call address in the event of another
device becoming master of the bus. In other words, if AA is reset, the I
2
C interface cannot
enter a slave mode. STA, STO, and SI must be reset.
The master transmitter mode may now be entered by setting the STA bit. The I
2
C logic will
now test the I
2
C bus and generate a start condition as soon as the bus becomes free.
When a START condition is transmitted, the serial interrupt flag (SI) is set, and the status
code in the status register (I2STAT) will be 0x08. This status code is used by the interrupt
service routine to enter the appropriate state service routine that loads I2DAT with the
slave address and the data direction bit (SLA+W). The SI bit in I2CON must then be reset
before the serial transfer can continue.
When the slave address and the direction bit have been transmitted and an
acknowledgment bit has been received, the serial interrupt flag (SI) is set again, and a
number of status codes in I2STAT are possible. There are 0x18, 0x20, or 0x38 for the
master mode and also 0x68, 0x78, or 0xB0 if the slave mode was enabled (AA = logic 1).
The appropriate action to be taken for each of these status codes is detailed in
. After a repeated start condition (state 0x10). The I
2
C block may switch to
the master receiver mode by loading I2DAT with SLA+R).
9.2 Master Receiver mode
In the master receiver mode, a number of data bytes are received from a slave transmitter
(see
). The transfer is initialized as in the master transmitter mode. When
the start condition has been transmitted, the interrupt service routine must load I2DAT with
the 7 bit slave address and the data direction bit (SLA+R). The SI bit in I2CON must then
be cleared before the serial transfer can continue.
When the slave address and the data direction bit have been transmitted and an
acknowledgment bit has been received, the serial interrupt flag (SI) is set again, and a
number of status codes in I2STAT are possible. These are 0x40, 0x48, or 0x38 for the
master mode and also 0x68, 0x78, or 0xB0 if the slave mode was enabled (AA = 1). The
appropriate action to be taken for each of these status codes is detailed in
.
After a repeated start condition (state 0x10), the I
2
C block may switch to the master
transmitter mode by loading I2DAT with SLA+W.
9.3 Slave Receiver mode
In the slave receiver mode, a number of data bytes are received from a master transmitter
(see
). To initiate the slave receiver mode, I2ADR and I2CON must be
loaded as follows:
Table 336. I2CONSET used to initialize Master Transmitter mode
Bit
7
6
5
4
3
2
1
0
Symbol
-
I2EN
STA
STO
SI
AA
-
-
Value
-
1
0
0
0
x
-
-
Table 337. I2C0ADR and I2C1ADR usage in Slave Receiver mode
Bit
7
6
5
4
3
2
1
0
Symbol
own slave 7 bit address
GC