📄 hz_disp.lst
字号:
202 {0x20,0x80,0x4F,0xF8,0x88,0x80,0x08,0x80},
203 {0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x80},
204 {0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80}},
205 //时
206 {
207 {0x08,0x00,0x0F,0xFC,0x10,0x80,0x10,0x80},
208 {0x20,0x80,0x4F,0xF8,0x88,0x80,0x08,0x80},
209 {0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x80},
210 {0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80}},
211 //间
212 {
213 {0x08,0x00,0x0F,0xFC,0x10,0x80,0x10,0x80},
214 {0x20,0x80,0x4F,0xF8,0x88,0x80,0x08,0x80},
215 {0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x80},
216 {0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80}},
217 //是
218 {
219 {0x08,0x00,0x0F,0xFC,0x10,0x80,0x10,0x80},
220 {0x20,0x80,0x4F,0xF8,0x88,0x80,0x08,0x80},
221 {0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x80},
222 {0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80}},
223 //:
224 {
225 {0x08,0x00,0x0F,0xFC,0x10,0x80,0x10,0x80},
226 {0x20,0x80,0x4F,0xF8,0x88,0x80,0x08,0x80},
227 {0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x80},
228 {0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80}}};
229 void delay(void){
230 1 unsigned char i,j;
231 1 for (i=0;i<255;i++)
232 1 for(j=0;j<255;j++)
233 1 ;
234 1 }
235 void check_GLCD_busyflag(void)
236 {
237 1 unsigned char x;
238 1 GLCD_R_W=READ;
239 1 GLCD_D_I=COMMAND;
240 1 GLCD_ENABLE=ENABLE;
C51 COMPILER V8.02 HZ_DISP 04/09/2008 21:44:53 PAGE 5
241 1 P0=255;
242 1 do{
243 2 x=P0 && 128;}while(x);
244 1 GLCD_ENABLE=DISABLE;
245 1 GLCD_D_I=1;
246 1 GLCD_R_W=1;
247 1 }
248 void write_GLCD_command(unsigned command)
249 {
250 1 GLCD_R_W=WRITE;
251 1 GLCD_D_I= COMMAND;
252 1 GLCD_ENABLE=ENABLE;
253 1 P0=command ;
254 1 GLCD_ENABLE=DISABLE;
255 1 GLCD_D_I=1;
256 1 GLCD_R_W=1;
257 1 check_GLCD_busyflag();}
258 void write_GLCD_data(unsigned GLCDdata)
259 {
260 1 GLCD_R_W=WRITE;
261 1 GLCD_D_I= DATA;
262 1 GLCD_ENABLE=ENABLE;
263 1 P0=GLCDdata;
264 1 GLCD_ENABLE=DISABLE;
265 1 GLCD_D_I=0;
266 1 GLCD_R_W=1;
267 1 check_GLCD_busyflag();}
268 void clear_GLCD()
269 {
270 1 int i,j;
271 1 GLCD_RESET=0;
272 1 for(i=0;i<2;i++);
273 1 GLCD_RESET=1;
274 1 GLCD_CS1=1;
275 1 GLCD_CS2=1;
276 1 write_GLCD_command(GLCD_START_LINE_0);
277 1 for(i=0;i<8;i++)
278 1 {
279 2 write_GLCD_command(SET_PAGE+i);
280 2 write_GLCD_command(SET_Y_ADDRESS_0);
281 2 for(j=0;j<64;j++);
282 2 write_GLCD_data(0);
283 2 }
284 1 }
285 void show_pattern(unsigned char page,unsigned char y,unsigned char *pattern,unsigned char len)
286 {
287 1 int i;
288 1 write_GLCD_command(SET_PAGE+page);
289 1 write_GLCD_command(SET_Y_ADDRESS_0+y);
290 1 for(i=0;i<len;i++);
291 1 {write_GLCD_data(*pattern);
292 2 pattern++;
293 2 }
294 1 }
295 void clear_pattrn(unsigned char page,unsigned char y,unsigned char len)
296 {
297 1 int i;
298 1 write_GLCD_command(SET_PAGE+page);
299 1 write_GLCD_command(SET_Y_ADDRESS_0+y);
300 1 for(i=0;i<len;i++);
301 1 write_GLCD_data(CLEAR);
302 1 }
C51 COMPILER V8.02 HZ_DISP 04/09/2008 21:44:53 PAGE 6
303 unsigned char read_GLCD_data(void)
304 {
305 1 unsigned char x;
306 1 GLCD_D_I=DATA;
307 1 GLCD_R_W=READ;
308 1 GLCD_ENABLE=ENABLE;
309 1 P0=255;
310 1 x=P0;
311 1 GLCD_ENABLE=DISABLE;
312 1 GLCD_D_I=0;
313 1 check_GLCD_busyflag();
314 1 GLCD_D_I=DATA;
315 1 GLCD_ENABLE=ENABLE;
316 1 x=P0;
317 1 GLCD_ENABLE=DISABLE;
318 1 check_GLCD_busyflag();
319 1 return x;
320 1 }
321 void putpixel(unsigned char x,unsigned char y)
322 {unsigned char i=1,temp,page_no;
323 1 if(x<64){
324 2 GLCD_CS1=0;
325 2 GLCD_CS2=1;
326 2 } else
327 1 {
328 2 GLCD_CS1=1;
329 2 GLCD_CS2=0;
330 2 x=x-64;}
331 1 write_GLCD_command(SET_Y_ADDRESS_0+y);
332 1 page_no=SET_PAGE+x/8;
333 1 write_GLCD_command(page_no);
334 1 temp=x%8;
335 1 while(temp){i=i*2;
336 2 temp--;
337 2 }
338 1 temp=read_GLCD_data();
339 1 i=i|temp;
340 1 write_GLCD_command(page_no);
341 1 write_GLCD_data(i);
342 1 }
343 void display_GLCD_data(unsigned char *p)
344 {
345 1 if(gx<64){
346 2 GLCD_CS1=1;
347 2 GLCD_CS2=0;
348 2 show_pattern(gy,gx,p,8);
349 2 show_pattern(gy,gx+8,p+8,8);
350 2 show_pattern(gy+1,gx,p+16,8);
351 2 show_pattern(gy+1,gx+8,p+24,8);
352 2 }else
353 1 {
354 2 GLCD_CS1=0;
355 2 GLCD_CS2=1;
356 2 show_pattern(gy,gx-64,p,8);
357 2 show_pattern(gy,gx-58,p+8,8);
358 2 show_pattern(gy+1,gx-64,p+16,8);
359 2 show_pattern(gy+1,gx-58,p+24,8);
360 2 }
361 1 gx=gx+16;
362 1 }
363 void display_GLCD_string(unsigned char *p,int len)
364 {
C51 COMPILER V8.02 HZ_DISP 04/09/2008 21:44:53 PAGE 7
365 1 int i;
366 1 for(i=0;i<len;i++)
367 1 display_GLCD_data((p+32*i));
368 1 }
369 void display_GLCD_number(char number)
370 {
371 1 int x,y;
372 1 x=number/10;
373 1 y=number%10;
374 1 display_GLCD_data(digit[x]);
*** WARNING C182 IN LINE 374 OF HZ_DISP.C: pointer to different objects
375 1 display_GLCD_data(digit[y]);
*** WARNING C182 IN LINE 375 OF HZ_DISP.C: pointer to different objects
376 1 }
377 void gotoxy(unsigned x,unsigned y)
378 {gy=y;
379 1 gx=x;}
380 void main(void)
381 {
382 1 unsigned char i=0;
383 1 clear_GLCD();
384 1 gotoxy(0,0);
385 1 display_GLCD_string(token,7);
*** WARNING C182 IN LINE 385 OF HZ_DISP.C: pointer to different objects
386 1 now.hour=12;
387 1 now.minute=30;
388 1 now.second=0;
389 1 gotoxy(0,4);
390 1 display_GLCD_number( now.hour);
391 1 display_GLCD_data(comma);
*** WARNING C182 IN LINE 391 OF HZ_DISP.C: pointer to different objects
392 1 display_GLCD_number( now.minute);
393 1 display_GLCD_data(comma);
*** WARNING C182 IN LINE 393 OF HZ_DISP.C: pointer to different objects
394 1 display_GLCD_number(now.second);
395 1 today.year=5;
396 1 today.month=9;
397 1 today.day=1;
398 1 gotoxy(0,6);
399 1 display_GLCD_number(today.year);
400 1 display_GLCD_data(slash);
*** WARNING C182 IN LINE 400 OF HZ_DISP.C: pointer to different objects
401 1 display_GLCD_number(today.month);
402 1 display_GLCD_data(slash);
*** WARNING C182 IN LINE 402 OF HZ_DISP.C: pointer to different objects
403 1 display_GLCD_number(today.day);
404 1 //while(1);
405 1 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -