Rev. 1.20
112
�an�a�� 2�� 201�
Rev. 1.20
11�
�an�a�� 2�� 201�
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
The IICD register is used to store the data being transmitted and received. Before the device writes
data to the I
2
C bus, the actual data to be transmitted must be placed in the IICD register. After the
data is received from the I
2
C bus, the device can read it from the IICD register. Any transmission or
reception of data from the I
2
C bus must be made via the IICD register.
IICD Register
Bit
7
6
5
4
3
2
1
0
Name
IICD7
IICD6
IICD�
IICD4
IICD�
IICD2
IICD1
IICD0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
POR
x
x
x
x
x
x
x
x
"x" �nknown
IICA Register
Bit
7
6
5
4
3
2
1
0
Name
IICA6
IICA�
IICA4
IICA�
IICA2
IICA1
IICA0
—
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
—
POR
0
0
0
0
0
0
0
—
Bit 7~1
IICA6~IICA0
: I
2
C slave address
IICA6~ IICA0 is the I
2
C slave address bit 6 ~ bit 0
.
The IICA register is the location where the 7-bit slave address of the slave device
is stored. Bits 7~ 1 of the IICA register define the device slave address. Bit 0 is not
defined.
When a master device, which is connected to the I
2
C bus, sends out an address, which
matches the slave address in the IICA register, the slave device will be selected.
Bit 0
Unimplemented, read as "0"
I
2
C Bus Communication
Communication on the I
2
C 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 I
2
C 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 I
2
C interrupt will be generated. After entering the interrupt
service routine, the slave device must first check the condition of the IICHAAS and I2CTOF
bit
s to determine whether the interrupt source originates from an address match or from an I
2
C
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 I
2
C 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 I
2
C bus.
• Step 2
Write the slave address of the device to the I
2
C bus address register IICA.
• Step 3
Set the IICE interrupt enable bit of the interrupt control register to enable the I
2
C interrupt
.
Содержание BS82B12A-3
Страница 33: ...Rev 1 20 33 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...
Страница 34: ...Rev 1 20 34 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...
Страница 35: ...Rev 1 20 35 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...