been transmitted, the following bit, which is the 8th bit, is the read/write bit whose value will be
placed in the SRW bit. This bit will be checked by the microcontroller 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 initialize the bus, the following are steps to achieve this:
·
Step 1
Write the slave address of the microcontroller to the I
2
C bus address register HADR.
·
Step 2
Set the HEN bit in the I
2
C bus control register to
²
1
²
to enable the I
2
C bus.
·
Step 3
Set the EHI bit of the interrupt control register to enable the I
2
C bus interrupt.
®
Start Signal
The START signal can only be generated by the master device connected to the I
2
C bus and not
by the microcontroller, which is only a slave device. This START signal will be detected by all de-
vices connected to the I
2
C bus. When detected, this indicates that the I
2
C bus is busy and there-
fore the HBB 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.
®
Slave Address
The transmission of a START signal by the master will be detected by all devices on the I
2
C bus.
To determine which slave device the master wishes to communicate with, the address of the slave
device will be sent out immediately following the START signal. All slave devices, after receiving
this 7-bit address data, will compare it with their own 7-bit slave address. If the address sent out by
the master matches the internal address of the microcontroller slave device, then an internal I
2
C
bus interrupt signal will be generated. The next bit following the address, which is the 8th bit, de-
fines the read/write status and will be saved to the SRW bit of the HSR register. The device will
then transmit an acknowledge bit, which is a low level, as the 9th bit. The microcontroller slave de-
vice will also set the status flag HAAS when the addresses match.
As an I
2
C bus interrupt can come from two sources, when the program enters the interrupt subrou-
tine, the HAAS bit should be examined to see whether the interrupt source has come from a
Chapter 1 Hardware Structure
57
S T A R T s i g n a l
f r o m M a s t e r
S e n d s l a v e a d d r e s s
a n d R / W b i t f r o m M a s t e r
A c k n o w l e d g e
f r o m s l a v e
S e n d d a t a b y t e
f r o m M a s t e r
A c k n o w l e d g e
f r o m s l a v e
S T O P s i g n a l
f r o m M a s t e r
Summary of Contents for HT46R22
Page 7: ...vi A D Type MCU...
Page 9: ...viii A D Type MCU...
Page 10: ...P a r t I Microcontroller Profile Part I Microcontroller Profile 1...
Page 11: ...2 A D Type MCU...
Page 90: ...P a r t I I Programming Language Part II Programming Language 81...
Page 91: ...82 A D Type MCU...
Page 97: ...88 A D Type MCU...
Page 128: ...P a r t I I I Development Tools Part III Development Tools 119...
Page 129: ...120 A D Type MCU...
Page 140: ...Appendix Appendix 131...
Page 141: ...132 A D Type MCU...
Page 151: ...142 A D Type MCU...
Page 152: ...A p p e n d i x B Package Information Appendix B Package Information 143 B...
Page 161: ...A D Type MCU...
Page 162: ...Amendments...