Initialization; Master Transmit Operation - Renesas H8S/2100 Series Hardware Manual

6-bit single-chip microcomputer
Hide thumbs Also See for H8S/2100 Series:
Table of Contents

Advertisement

17.4.2

Initialization

Initialize the IIC by the procedure shown in figure 17.6 before starting transmission/reception of
data.
Start initialization
Set MSTP4 = 0 (IIC_0)
MSTP3 = 0 (IIC_1)
MSTPB4 = 0 (IIC_2)
(MSTPCRL, MSTPCRB)
Set IICE = 1 in STCR
Set ICE = 0 in ICCR
Set SAR and SARX
Set ICE = 1 in ICCR
Set ICSR
Set STCR
Set ICMR
Set ICXR
Set ICCR
<< Start transmit/receive operation >>
Note: Be sure to modify the ICMR register after transmit/receive operation has been completed.
If the ICMR register is modified during transmit/receive operation, bit counter BC2 to
BC0 will be modified erroneously, thus causing incorrect operation.
17.4.3

Master Transmit Operation

2
In I
C bus format master transmit mode, the master device outputs the transmit clock and transmit
data, and the slave device returns an acknowledge signal.
Figure 17.7 shows the sample flowchart for the operations in master transmit mode.
Cancel module stop mode
Enable the CPU accessing to the IIC control register and data register
Enable SAR and SARX to be accessed
Set the first and second slave addresses and IIC communication format
(SVA6 to SVA0, FS, SVAX6 to SVAX0, and FSX)
Enable ICMR and ICDR to be accessed
Use SCL/SDA pin as an IIC port
Set acknowledge bit (ACKB)
Set transfer rate (IICX)
Set communication format, wait insertion, and transfer rate
(MLS, WAIT, CKS2 to CKS0)
Enable interrupt, set communication operation
(STOPIM, HNDS, ALIE, ALSL, FNC1, and FNC0)
Be sure to set as follows: HNDS = 1, FNC1 = 1, and FNC0 = 1.
Set interrupt enable, transfer mode, and acknowledge decision
(IEIC, MST, TRS, and ACKE)
Figure 17.6 Sample Flowchart for IIC Initialization
2
Section 17 I
C Bus Interface (IIC)
Rev. 1.00 May 09, 2008 Page 523 of 954
REJ09B0462-0100

Advertisement

Table of Contents
loading

This manual is also suitable for:

H8s/2112r

Table of Contents