added notes for how to setup android dev environment in Fedora - /athena/notes/androi...
[athena:athena.git] / firmware / ref / archive-code / LCDTest / LCDTest.c
1 #define F_CPU 1000000UL \r
2 \r
3 #include <avr/io.h>\r
4 \r
5 #include <util/delay.h>\r
6 \r
7 #include"lcd_16.h"\r
8 \r
9 //#include <inttypes.h>\r
10 //#include"lcd_16.c"\r
11 \r
12 int sec=0;\r
13 int min=0;\r
14 int hr=0;\r
15 \r
16 char s[2];\r
17 char m[2];\r
18 char h[2];\r
19 \r
20 \r
21 int main()\r
22 {\r
23         lcd_init(LCD_DISP_ON);\r
24         lcd_puts("00:00:00");\r
25 \r
26         while(1)\r
27         {\r
28 \r
29                 _delay_ms(130);\r
30 \r
31                 sec++;\r
32 \r
33         // printing seconds\r
34                 lcd_gotoxy(6,0);\r
35                 //iota(sec,s,2);\r
36                 //lcd_puts((char*)sec);\r
37                 sprintf(s,"%2d",sec);\r
38                 lcd_puts(s);\r
39 \r
40                 if(sec>=59)\r
41                 {\r
42                         sec=0;\r
43                         min++;\r
44                 }\r
45 \r
46 \r
47         // printing minutes\r
48                 lcd_gotoxy(3,0);\r
49                 //iota(min,m,2);\r
50                 sprintf(m,"%2d",min);\r
51                 lcd_puts(m);\r
52                 \r
53 \r
54                 if(min>=59)\r
55                 {\r
56                         min=0;\r
57                         hr++;\r
58                 }\r
59 \r
60 \r
61                 // printing hours\r
62                 lcd_gotoxy(0,0);\r
63                 //iota(hr,h,2);\r
64                 sprintf(h,"%2d",hr);\r
65                 lcd_puts(h);\r
66 \r
67                 if(hr>=59)\r
68                 {\r
69                         min=0;\r
70                         hr=0;\r
71                         sec=0;\r
72                 }\r
73 \r
74                 \r
75 \r
76                 \r
77 \r
78         }\r
79 \r
80 }\r