Download Thesis 1. I2C Software Implementation

Transcript
NXP Semiconductors
Fontys University of Applied Sciences
Thesis
Version 1.0
Power
SDA
Debugger
SV6 Pin7
SV10 Pin1 (red wire)
SV10 Pin3 (black wire)
SV3 Pin9
SCL
Figure 1-12: Board connection for I2C example
1.6
I2C Programming
1.6.1
Demo Level
The desired result of this demo is that LED is on when the user presses button. The demo is designed to be in
a while loop, continually check the button state and compare it with last read value, transfer it into LED state if
the button state changes. It’s the responsibility of SGPIO to read the states of touch buttons and transfer
corresponding LED states. Below is the flow chart on demo level.
Start
Read
button state
button state
≠ last button state
N
Y
last button state =
button state
Set LED
state
End
Figure 1-13: Flow chart of I2C demo-level programming
IX