?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik //*****************************************************************************
2 //
3 // File Name : 'glcdtest.h'
4 // Title : Graphic LCD test and examples code
5 // Author : Pascal Stang
6 // Created : 7/12/2001
7 // Revised : 9/30/2002
8 // Version : 1.1
9 // Target MCU : Atmel AVR series
10 // Editor Tabs : 4
11 //
12 // Description : This code tests and demonstrates the AVRlib graphic LCD
13 // driver, glcd.c.
14 //
15 // This code is distributed under the GNU Public License
16 // which can be found at http://www.gnu.org/licenses/gpl.txt
17 //
18 //*****************************************************************************
19  
20  
21 #include <avr/io.h>
22  
23 #include "global.h"
24 #include "uart.h"
25 #include "rprintf.h"
26 #include "timer.h"
27 #include "a2d.h"
28  
29 #include "ks0108.h"
30 #include "glcd.h"
31  
32 #define KEY1 0x01 // Key1
33 #define KEY2 0x02 // Key2
34 #define KEY3 0x04 // Key3
35 #define KEY4 0x08 // Key4
36 #define KEY5 0x10 // Key5
37 #define KEY6 0x20 // Key6
38 #define KEY7 0x40 // Key7
39 #define KEY8 0x80 // Key8
40  
41 void lcdtest(void);
42 void oscope(void);
43  
44 int main (void)
45 {
46 // initialize
47 uartInit();
48 timerInit();
49 a2dInit();
50 glcdInit();
51 outb(DDRA, 0x00);
52  
53 // send rprintf output to serial port
54 rprintfInit(uartSendByte);
55 // print welcome message to serial port
56 rprintfProgStrM("\r\nWelcome to glcdtest...\r\n");
57 // send rprintf output to lcd display
58 rprintfInit(glcdWriteChar);
59  
60 // perform basic functionality tests
61 rprintfProgStrM("All initialized...");
62  
63 glcdSetAddress(4,LINE2);
64 glcdWriteChar('H');
65 glcdWriteChar('E');
66 glcdWriteChar('L');
67 glcdWriteChar('L');
68 glcdWriteChar('O');
69  
70 glcdSetAddress(4,LINE3);
71 rprintfProgStrM("line 3");
72 glcdSetAddress(4,LINE4);
73 rprintfProgStrM("line 4");
74 glcdSetAddress(4,LINE5);
75 rprintfProgStrM("line 5");
76  
77 // run application program
78 //oscope();
79 lcdtest();
80  
81 return 0;
82 }
83  
84 void oscope(void)
85 {
86 u08 i=0;
87 u08 oldbuffer[128];
88 u08 newbuffer[128];
89  
90 glcdClearScreen();
91  
92 while(1)
93 {
94 for(i=0; i<128; i++)
95 oldbuffer[i] = newbuffer[i];
96  
97 for(i=0; i<128; i++)
98 newbuffer[i] = a2dConvert8bit(0);
99  
100 for(i=0; i<128; i++)
101 {
102 glcdClearDot(i,oldbuffer[i]>>2);
103 glcdSetDot(i,newbuffer[i]>>2);
104 }
105 }
106 }
107  
108 void lcdtest(void)
109 {
110 unsigned char key = 0;
111  
112 glcdClearScreen();
113  
114 glcdSetAddress(4,LINE2);
115 glcdPutStr("Graphic LCD Test");
116 glcdSetAddress(4,LINE3);
117 glcdPutStr("HD61202/3 controller");
118 glcdSetAddress(4,LINE4);
119 glcdPutStr("KS0108/7 controller");
120 glcdSetAddress(4,LINE5);
121 glcdPutStr("Press buttons to");
122 glcdSetAddress(4,LINE6);
123 glcdPutStr("test functions...");
124 glcdRectangle(0, 0, 64, 128);
125  
126 while(1)
127 {
128 timerPause(10);
129 key = ~inb(PINA);
130 glcdSetAddress(4,LINE7);
131 rprintf("Button status: %x ", key);
132  
133 if(key == KEY1)
134 {
135 unsigned char i ;
136 glcdClearScreen();
137 for ( i=0; i<128; i+=3)
138 {
139 glcdSetDot(i,63 - i/2);
140 glcdDelay(0x5fff);
141 }
142 for ( i=0; i<128; i+=3)
143 {
144 glcdClearDot(i,63 - i/2);
145 glcdDelay(0x5fff);
146 }
147 }
148  
149 if(key == KEY2)
150 {
151 glcdClearScreen();
152 glcdCircle(25,20,17);
153 glcdDelay(0xffff);
154 glcdCircle(90,30,15);
155 glcdDelay(0xffff);
156 glcdCircle(55,30,23);
157 glcdDelay(0xffff);
158 glcdCircle(100,48,15);
159 glcdDelay(0xffff);
160 glcdCircle(34,50,10);
161 glcdDelay(0xffff);
162 glcdCircle(60,55,8);
163 }
164  
165 if(key == KEY3)
166 {
167 glcdClearScreen();
168 glcdRectangle(54, 41, 6 , 12);
169 glcdDelay(0xffff);
170 glcdRectangle(34, 12, 32, 2);
171 glcdDelay(0xffff);
172 glcdRectangle(23, 34, 17, 21);
173 glcdDelay(0xffff);
174 glcdRectangle(62, 20, 42, 58);
175 glcdDelay(0xffff);
176 glcdRectangle(4 , 30, 12, 12);
177 }
178  
179 if(key == KEY4)
180 {
181 glcdClearScreen();
182 glcdSetAddress(0,LINE1);
183 glcdPutStr("LINE 1"); glcdDelay(0xffff);
184 glcdSetAddress(5,LINE2);
185 glcdPutStr("LINE 2"); glcdDelay(0xffff);
186 glcdSetAddress(10,LINE3);
187 glcdPutStr("LINE 3"); glcdDelay(0xffff);
188 glcdSetAddress(15,LINE4);
189 glcdPutStr("LINE 4"); glcdDelay(0xffff);
190 glcdSetAddress(20,LINE5);
191 glcdPutStr("LINE 5"); glcdDelay(0xffff);
192 glcdSetAddress(25,LINE6);
193 glcdPutStr("LINE 6"); glcdDelay(0xffff);
194 glcdSetAddress(30,LINE7);
195 glcdPutStr("LINE 7"); glcdDelay(0xffff);
196 glcdSetAddress(35,LINE8);
197 glcdPutStr("LINE 8"); glcdDelay(0xffff);
198 }
199  
200 if(key == KEY5)
201 {
202 glcdClearScreen();
203 glcdSetAddress(0,LINE2);
204 glcdPutStr(" !");
205 glcdWriteChar('"');
206 glcdPutStr("#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ");
207 glcdPutStr("[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
208 }
209  
210 if(key == KEY6)
211 {
212 unsigned char i;
213 for (i=0; i<64; i++)
214 {
215 glcdStartLine(64- i - 1);
216 glcdDelay(0x5fff);
217 }
218 }
219  
220 if(key == KEY7)
221 {
222 unsigned char i;
223 for (i=0; i<64; i++)
224 {
225 glcdStartLine(i + 1);
226 glcdDelay(0x5fff);
227 }
228 }
229  
230 if (key == KEY8)
231 {
232 // glcdBackLight(OFF);
233 // glcdBackLight(ON);
234 }
235 }
236 }
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3