|
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
|
▷ |