Example Of Use; Figure 15.17 Sample Flowchart For Master Transmit Mode - Renesas H8/36912 Series User Manual

16-bit single-chip microcomputer
Hide thumbs Also See for H8/36912 Series:
Table of Contents

Advertisement

15.4.8

Example of Use

Flowcharts in respective modes that use the I
Start
Initialize
Read BBSY in ICCR2
No
BBSY=0 ?
Set MST and TRS
in ICCR1 to 1.
Write 1 to BBSY
and 0 to SCP.
Write transmit data
in ICDRT
Read TEND in ICSR
No
TEND=1 ?
Read ACKBR in ICIER
ACKBR=0 ?
Transmit
mode?
Write transmit data in ICDRT
Read TDRE in ICSR
No
TDRE=1 ?
No
Last byte?
Write transmit data in ICDRT
Read TEND in ICSR
No
TEND=1 ?
Clear TEND in ICSR
Clear STOP in ICSR
Write 0 to BBSY
and SCP
Read STOP in ICSR
No
STOP=1 ?
Set MST to 1 and TRS
to 0 in ICCR1
Clear TDRE in ICSR
End
Downloaded from
Elcodis.com
electronic components distributor
[1] Test the status of the SCL and SDA lines.
[2] Set master transmit mode.
[1]
[3] Issue the start candition.
Yes
[4] Set the first byte (slave address + R/ ) of transmit data.
[2]
[5] Wait for 1 byte to be transmitted.
[3]
[6] Test the acknowledge transferred from the specified slave device.
[4]
[7] Set the second and subsequent bytes (except for the final byte) of transmit data.
[5]
[8] Wait for ICDRT empty.
Yes
[9] Set the last byte of transmit data.
[6]
[10] Wait for last byte to be transmitted.
No
[11] Clear the TEND flag.
Yes
No
Mater receive mode
Yes
[12] Clear the STOP flag.
[7]
[13] Issue the stop condition.
[8]
[14] Wait for the creation of stop condition.
Yes
[15] Set slave receive mode. Clear TDRE.
[9]
Yes
[10]
Yes
[11]
[12]
[13]
[14]
Yes
[15]

Figure 15.17 Sample Flowchart for Master Transmit Mode

2
C bus interface are shown in figures 15.17 to 15.20.
Rev. 1.00, 11/03, page 249 of 376

Advertisement

Table of Contents
loading

Table of Contents