Datasheet
Inter-Integrated Circuit (S08IICV1)
MC9S08QG8 and MC9S08QG4 Data Sheet, Rev. 5
170 Freescale Semiconductor
11.7 Initialization/Application Information
Figure 11-10. IIC Module Quick Start
Module Initialization (Slave)
1. Write: IICA
— to set the slave address
2. Write: IICC
— 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 11-11
Module Initialization (Master)
1. Write: IICF
— to set the IIC baud rate (example provided in this chapter)
2. Write: IICC
— 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 11-11
5. Write: IICC
— to enable TX
6. Write: IICC
— to enable MST (master mode)
7. Write: IICD
— with the address of the target slave. (The LSB of this byte will determine whether the communication is
master receive or transmit.)
Module Use
The routine shown in Figure 11-11 can handle both master and slave IIC operations. For slave operation, an
incoming IIC message that contains the proper address will begin IIC communication. For master operation,
communication must be initiated by writing to the IICD register.
0
IICF
IICA
Baud rate = BUSCLK / (2 x MULT x (SCL DIVIDER))
TX TXAK RSTA 0 0
IICC
IICEN IICIE MST
Module configuration
ARBL 0 SRW IICIF RXAK
IICS
TCF IAAS BUSY
Module status flags
Register Model
ADDR
Address to which the module will respond when addressed as a slave (in slave mode)
MULT
ICR
IICD
DATA
Data register; Write to transmit IIC data read to read IIC data
