English
Language : 

BS82B12A-3 Datasheet, PDF (114/170 Pages) Holtek Semiconductor Inc – Touch Flash MCU with LED/LCD Driver
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Flash MCU with LED/LCD Driver
I2C Bus Communication
Communication on the I2C bus requires four separate steps, a START signal, a slave device address
transmission, a data transmission and finally a STOP signal. When a START signal is placed on
the I2C bus, all devices on the bus will receive this signal and be notified of the imminent arrival of
data on the bus. The first seven bits of the data will be the slave address with the first bit being the
MSB. If the address of the slave device matches that of the transmitted address, the IICHAAS bit
in the IICC1 register will be set and an I2C interrupt will be generated. After entering the interrupt
service routine, the slave device must first check the condition of the IICHAAS and I2CTOF
bits to determine whether the interrupt source originates from an address match or from an I2C
communication time-out or from the completion of an 8-bit data transfer. During a data transfer, note
that after the 7-bit slave address has been transmitted, the following bit, which is the 8th bit, is the
read/write bit whose value will be placed in the IICSRW bit. This bit will be checked by the slave
device to determine whether to go into transmit or receive mode. Before any transfer of data to or
from the I2C bus, the microcontroller must initialise the bus, the following are steps to achieve this:
• Step 1
Set the IICEN bit in the IICC0 register high to enable the I2C bus.
• Step 2
Write the slave address of the device to the I2C bus address register IICA.
• Step 3
Set the IICE interrupt enable bit of the interrupt control register to enable the I2C interrupt.
S ta rt
S E T IIC E N
W r ite S la v e
A d d re s s to IIC A
D is a b le
C L R IIC E
P o ll IIC F to d e c id e
w h e n to g o to I2C B u s IS R
I2C B u s
In te rru p t= ?
E n a b le
S E T IIC E
W a it fo r In te r r u p t
G o to M a in P r o g r a m
G o to M a in P r o g r a m
I2C Bus Initialisation Flow Chart
I2C Bus Start Signal
The START signal can only be generated by the master device connected to the I2C bus and not by
the slave device. This START signal will be detected by all devices connected to the I2C bus. When
detected, this indicates that the I2C bus is busy and therefore the IICHBB bit will be set. A START
condition occurs when a high to low transition on the SDA line takes place when the SCL line
remains high.
Rev. 1.60
114
December 15, 2016