-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsec_stop_watch_using_lcd.c
More file actions
46 lines (45 loc) · 1.06 KB
/
sec_stop_watch_using_lcd.c
File metadata and controls
46 lines (45 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "lcd_defines.h"
#include "lcd.h"
#include "arduino.h"
#include "types.h"
#define TRIG_SW 4
u32 time=0,flag=0,dly;
main(){
Init_LCD();
StrLCD("SECs STOP WATCH : ");
while(1){
CmdLCD(GOTO_LINE2_POS0);
U32LCD(time);
while(digitalRead(TRIG_SW)==0){
flag=1;
}
while(flag==1){
dly=1000000;
while(dly--){
if(digitalRead(TRIG_SW)==0){
break;
}
}
CmdLCD(GOTO_LINE2_POS0);
U32LCD(time);
while(digitalRead(TRIG_SW)==0){
flag=2;
}
if(flag!=2) time++;
if(time>59){
time=0;
CmdLCD(GOTO_LINE2_POS0);
StrLCD(" ");
}
}
while(flag==2){
while(digitalRead(TRIG_SW)==0){
time=flag=0;
CmdLCD(GOTO_LINE2_POS0);
StrLCD(" ");
CmdLCD(GOTO_LINE2_POS0);
U32LCD(time);
}
}
}
}