Figure 17.19 Sample Flowchart For Master Receive Mode - Renesas H8S/2158 User Manual

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

Advertisement

Master receive operation
Set TRS = 0 in ICCR
Set WAIT = 1 in ICMR
Set ACKB = 0 in ICSR
Read ICDR
Clear IRIC in ICCR
Read IRIC in ICCR
No
IRIC = 1?
Last receive?
Clear IRIC in ICCR
Read IRIC in ICCR
No
IRIC = 1?
Yes
Read ICDR
Clear IRIC in ICCR
Read IRIC in ICCR
No
IRIC = 1?
Yes
Last receive?
No
Clear IRIC in ICCR
Set ACKB = 1 in ICSR
Set TRS = 1 in ICCR
Clear IRIC = 1 in ICCR
Read IRIC in ICCR
No
IRIC = 1?
Yes
Set WAIT = 0 in ICMR
Read ICDR
Clear IRIC in ICCR
Set BBSY = 0 and
SCP = 0 in ICCR
End

Figure 17.19 Sample Flowchart for Master Receive Mode

[1] Select receive mode.
[2] Start receiving. The first read
is a dummy read. (After reading from
ICDR, clear IRIC continuously.)
[3] Wait for 1 byte to be received.
Yes
Yes
No
[4] Clear IRIC.
(to end the wait insertion)
[5] Wait for 1 byte to be received.
[6] Read the receive data.
[7] Clear IRIC.
[8] Wait for the data for the second
and subsequent bytes to be received.
Yes
[9] Clear IRIC.
(to end the wait insertion)
[10] Set acknowledge data for
the last reception.
[11] Clear IRIC.
(to end the wait insertion)
[12] Wait for 1 byte to be received.
[13] Clear wait mode.
Read receive data.
Clear IRIC.
( IRIC should be cleared to 0
after setting WAIT = 0.)
[14] Stop condition issuance.
Rev. 3.00 Jan 25, 2006 page 537 of 872
2
Section 17 I
C Bus Interface (IIC)
REJ09B0286-0300

Advertisement

Table of Contents
loading

Table of Contents