UM10413
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2011. All rights reserved.
User manual
Rev. 1 — 16 December 2011
144 of 268
NXP Semiconductors
UM10413
MPT612 User manual
The I
2
C hardware now begins checking the I
2
C-bus for its own slave address and general
call. If the general call or the own slave address is detected, an interrupt is requested and
I2STAT is loaded with the appropriate state information.
16.8.16 I
2
C interrupt service
When the I
2
C interrupt is entered, I2STAT contains a status code which identifies one of
the 26 state services to be executed.
16.8.17 The state service routines
Each state routine is part of the I
2
C interrupt routine and handles one of the 26 states.
16.8.18 Adapting state services to an application
The state service examples show the typical actions that must be performed in response
to the 26 I
2
C state codes. If one or more of the four I
2
C operating modes are not used, the
associated state services can be omitted, as long as care is taken that those states can
never occur.
In an application, it may be desirable to implement some kind of time-out during I
2
C
operations, in order to trap an inoperative bus or a lost service routine.
16.9 Software
example
16.9.1 Initialization routine
Example to initialize I
2
C interface as a slave and/or master.
1. Load I2ADR with own slave address, enable general call recognition if needed.
2. Enable I
2
C interrupt.
3. Write 0x44 to I2CONSET to set the I2EN and AA bits, enabling slave functions. For
master only functions, write 0x40 to I2CONSET.
16.9.2 Start master transmit function
Begin a master transmit operation by setting up the buffer, pointer, and data count, then
initiate a Start.
1. Initialize master data counter.
2. Set up the slave address to which data will be transmitted, and add the write bit.
3. Write 0x20 to I2CONSET to set bit STA.
4. Set up data to be transmitted in master transmit buffer.
5. Initialize the master data counter to match the length of the message being sent.
6. Exit.
16.9.3 Start master receive function
Begin a master receive operation by setting up the buffer, pointer, and data count, then
initiate a Start.
1. Initialize master data counter.
2. Set up the slave address to which data will be transmitted, and add the read bit.