EasyManuals Logo

NXP Semiconductors LPC11U3x User Manual

NXP Semiconductors LPC11U3x
523 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #325 background imageLoading...
Page #325 background image
UM10462 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2016. All rights reserved.
User manual Rev. 5.5 — 21 December 2016 325 of 523
NXP Semiconductors
UM10462
Chapter 14: LPC11U3x/2x/1x I2C-bus controller
14.10.8 Initialization
In the initialization example, the I
2
C block is enabled for both master and slave modes.
For each mode, a buffer is used for transmission and reception. The initialization routine
performs the following functions:
• ADR is loaded with the part’s own slave address and the General Call bit (GC)
• The I
2
C interrupt enable and interrupt priority bits are set
• The slave mode is enabled by simultaneously setting the I2EN and AA bits in CON
and the serial clock frequency (for master modes) is defined by is defined by loading
the
SCLH and SCLL registers. The master routines must be started in the main program.
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 STAT is loaded with the appropriate state information.
14.10.9 I
2
C interrupt service
When the I
2
C interrupt is entered, STAT contains a status code which identifies one of the
26 state services to be executed.
14.10.10 The state service routines
Each state routine is part of the I
2
C interrupt routine and handles one of the 26 states.
14.10.11 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 the 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.
14.11 Software example
14.11.1 Initialization routine
Example to initialize I
2
C Interface as a Slave and/or Master.
1. Load ADR with own Slave Address, enable General Call recognition if needed.
2. Enable I
2
C interrupt.
3. Write 0x44 to CONSET to set the I2EN and AA bits, enabling Slave functions. For
Master only functions, write 0x40 to CONSET.
14.11.2 Start Master Transmit function
Begin a Master Transmit operation by setting up the buffer, pointer, and data count, then
initiating a START.
1. Initialize Master data counter.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the NXP Semiconductors LPC11U3x and is the answer not in the manual?

NXP Semiconductors LPC11U3x Specifications

General IconGeneral
BrandNXP Semiconductors
ModelLPC11U3x
CategoryMicrocontrollers
LanguageEnglish

Related product manuals