ST7 S/W IMPLEMENTATION OF I2C BUS MASTER
Figure 5. Flowchart of the transmission function
SDA configured as output
j=nb
count=1
I2C_DR=buffout[j]
shift of count
I2Cm_TxData
no
count overflows?
yes
wait Acknowledge
no
ACK ok?
yes
j--
AF=1
no
j=FF?
yes
END
The reception function is also based on a double shift: a shift of the “count” variable to call 8
times the function I2Cm_RxData (to receive the 8 bits of one data byte) and a shift of a buffer
into the I2Cm_RxData function to receive the data bit by bit on the LSB (refer to Figure 6).
6/16