Freescale Semiconductor MCF51QE128RM manual Initialization/Application Information, Module Use

Models: MCF51QE128RM

1 424
Download 424 pages 63.71 Kb
Page 277
Image 277

13.7Initialization/Application Information

Module Initialization (Slave)

1.Write: IICC2

to enable or disable general call

to select 10-bit or 7-bit addressing mode

2.Write: IICA

to set the slave address

3.Write: IICC1

to enable IIC and interrupts

4.Initialize RAM variables (IICEN = 1 and IICIE = 1) for transmit data

5.Initialize RAM variables used to achieve the routine shown in Figure 13-12

Module Initialization (Master)

1.Write: IICF

to set the IIC baud rate (example provided in this chapter)

2.Write: IICC1

to enable IIC and interrupts

3.Initialize RAM variables (IICEN = 1 and IICIE = 1) for transmit data

4.Initialize RAM variables used to achieve the routine shown in Figure 13-12

5.Write: IICC1

to enable TX

6.Write: IICC1

to enable MST (master mode)

7.Write: IICD

with the address of the target slave. (The lsb of this byte determines whether the communication is master receive or transmit.)

Module Use

The routine shown in Figure 13-12can handle both master and slave IIC operations. For slave operation, an incoming IIC message that contains the proper address begins IIC communication. For master operation, communication must be initiated by writing to the IICD register.

Register Model

IICA

AD[7:1]

0

IICF

When addressed as a slave (in slave mode), the module responds to this address

MULT

 

ICR

 

 

 

 

Baud rate = BUSCLK / (2 x MULT x (SCL DIVIDER))

IICC1

IICEN

 

IICIE

 

MST

 

TX

TXAK

 

RSTA

 

0

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Module configuration

IICS

TCF

 

IAAS

 

BUSY

 

ARBL

0

 

SRW

 

IICIF

 

RXAK

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Module status flags

IICD

DATA

Data register; Write to transmit IIC data read to read IIC data

IICC2

GCAEN

 

ADEXT

 

0

 

0

0

 

AD10

 

AD9

 

AD8

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Address configuration

Figure 13-11. IIC Module Quick Start

MCF51QE128 MCU Series Reference Manual, Rev. 3

Freescale Semiconductor

2-277

Page 277
Image 277
Freescale Semiconductor MCF51QE128RM manual Initialization/Application Information, Module Initialization Slave, Module Use