English
Language : 

7220 Datasheet, PDF (203/303 Pages) Renesas Technology Corp – 8-BIT SINGLE-CHIP MICROCOMPUTER
APPLICATION
5.5 Example of I2C-BUS control by software (M37220M3-XXXSP/FP)
(3) Data output processing routine
The data output, the START condition, the STOP condition, and the bus H processing routines are
the common routines within the transmit/receive processing routine.
Data output
Bit 0 of port P2 direction register
=“output mode”
“BIT COUNTER” = “0”
Rotate “WRITEDATA” left
with Carry flag
RAM: WRITEDATA
BIT COUNTER
Flag: F_ACK
No
Carry flag = “1”?
Yes
P20 (SDA) = “1”
P20 (SDA) = “0”
P21 (SCL) = “1”
Wait 6 µs
P21 (SCL) = “0”
“BIT COUNTER”
←“BIT COUNTER” + 1
No
“BIT COUNTER”
≥ “8”?
Yes
Bit 0 of port P2 direction register
= “input mode
Wait 6 µs
P21 (SCL) = “1”
Wait 6 µs
No
P20 (SDA) = “1”?
Yes
F_ACK = “1”
F_ACK = “0”
P21 (SCL) = “0”
RETURN
Fig. 5.5.6 Flowchart of data output processing routine
5-30
7220 Group User’s Manual