Chapter 13
Serial Interface
IIC Communication XIII - 69
Setting Example of Slave Communication
Figure:13.5.14 Slave Communication Setting Flow Diagram
Stop condition detection interrupt generation
IIC coommunication completion
Slave reception start
(Receive the slave address +R/W bit from the master)
Set transmission data to TXBUFn
Check of data transmission and reception
SCnIICSTR.IIC3WRS
Slave transmission
Slave reception
Set dummy data to TXBUFn
Start slave transmission
Start slave reception
NO
NO
End of slave transmission
End of slave reception
Communication completion?
YESYES
Communication completion interrupt
Communication completion interrupt
Communication completion?
Select MSB-first or LSB-first
Serial reset
SCnMD2.SCnRSTN=0
End of serial reset
SCnMD2.SCnRSTN=1
initializing monitor flag
SCnIICSTR.IIC3DATA_ERR=0
YES
NO
SCnSBCSLV
SCnDIR
Be sure to set it to "0".
Note:1 As initial setting, register changed at the time of serial reset is shown below.
Please change it if needed, such as interrupt setting or port setting.
Master setting at slave address transmission
SCnMD0 SCnCE1
SCnCTM
IIC3DEM
SCnMD1 SCnIOM
SCnMST
SCnSBTS
SCnSBIS
SCnSBOS
SCnMD2
SCnIFS
SCnCKPH
SCnSBCSEN
SCnMD3
IIC3STPC
IIC3REX
SCnCMD
IIC3ACKS
Other, SCnMD0, SCnMD3, SCnAD re
ister
SCnMD0
IIC3STE
SCnMD3 IIC3TMD
SCnAD IIC3AD7-0
Be sure to set it to "0".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "1".
Be sure to set it to "1".
Be sure to set it to "0".
Be sure to set it to "0".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "1".
Start condition setting
Slave address setting
Communication mode selectioon
Be sure to set it to "0".
Initial setting (*1)
Received slave address
is equal to SCnAD ?
ACK transmission by hardware
NACK transmission by hardware
Communication completion interrupt
Slave reception end
Serial transfer clock is needed to be set with BRTM_S_EN, BRTM_S_MD
and so forth.