Master - Renesas H8S/2158 User Manual

16-bit single-chip microcomputer h8s family/h8s/2100 series
Table of Contents

Advertisement

2
Section 17 I
C Bus Interface (IIC)
1. Clear the TRS bit in ICCR to 0 to switch from transmit mode to receive mode.
Set the WAIT bit in ICMR to 1.
Clear the ACKB bit in ICSR to 0 (acknowledge data setting).
2. When ICDR is read (dummy data read), reception is started, and the receive clock is output,
and data received, in synchronization with the internal clock.
In order to detect wait operation, clear the IRIC flag in ICCR to 0. After reading ICDR, clear
IRIC continuously so no other interrupt handling routine is executed. If the time for reception
of one frame of data has passed before the IRIC clearing, the end of reception cannot be
determined.
3. The IRIC flag is set to 1 at the fall of the 8th receive clock pulse. If the IEIC bit in ICCR has
been set to 1, an interrupt request is sent to the CPU.
SCL is automatically fixed low in synchronization with the internal clock until the IRIC flag
clearing. If the first frame is the last receive data, execute step [10] to halt reception.
4. Clear the IRIC flag to clear the wait state.
The master device outputs the 9th clock and drives SDA low at the 9th receive clock pulse to
return an acknowledge signal.
5. When one frame of data has been received, the IRIC flag in ICCR and the IRTR flag in ICSR
are set to 1 at the rise of the 9th receive clock pulse. The master device outputs the receive
clock to receive the next data.
6. Read ICDR receive data.
7. Clear the IRIC flag to 0 to detect the next wait operation.
Data reception process from steps [5] to [7] should be executed during one byte reception
period after IRIC flag clearing in step [4] or [9] to release the wait state.
8. The IRIC flag is set to 1 at the fall of the 8th receive clock pulse.
SCL is automatically fixed low in synchronization with the internal clock until the IRIC flag
clearing. If this frame is the last receive data, execute step [10] to halt reception.
9. Clear the IRIC flag in ICCR to cancel wait state.
The master device outputs the 9th clock and drives SDA 1ow at the 9th receive clock pulse to
return an acknowledge signal.
Data can be received continuously by repeating steps [5] to [9].
10. Set the ACKB bit in ICSR to 1 so as to return the acknowledge data for the last reception.
Set the TRS bit in ICCR to 1 to switch from receive mode to transmit mode.
11. Clear the IRIC flag to 0 to release the wait state.
12. When one frame of data has been received, the IRIC flag is set to 1 at the rise of the 9th
receive clock pulse.
Rev. 3.00 Jan 25, 2006 page 520 of 872
REJ09B0286-0300

Advertisement

Table of Contents
loading

Table of Contents