4.7LCD & AD & Key
Hardware Setting None
Flowchart
Start |
|
|
|
|
Initialization |
|
|
|
|
(clock, key, lcd, |
|
|
|
|
led, dual timer, ad) |
|
|
|
|
Press key? | Y | Set LCD update | Display key | |
|
| flag | pressed in LCD | |
|
|
| ||
N |
|
|
|
|
AD convert |
|
|
|
|
Pre_AD_value- |
| Y | Set LCD update | Display new AD |
Cur_AD_calue>threshold value |
| flag | value on LCD | |
N |
|
|
|
|
Count Time = 1s |
| Y | Count time = 0 |
|
|
|
| ||
N | N | LCD update flag = 1 ? |
| |
|
| |||
Count time++ |
|
| Y |
|
| Clear LCD update | Clear window and | ||
|
| |||
|
|
| flag | display logo in LCD |
Figure
Usage
1)Run the code
2)Press key, and the key pressed can display on the LCD
3)Regulate the potentiometer to change the input voltage of channel 7, and this voltage can be detected and displayed on LCD.
20