📄 text_fun.lst
字号:
259 1 _nop_();
260 1 WR_PORT=1 ;
*** ERROR C202 IN LINE 260 OF TEXT_FUN.C: 'WR_PORT': undefined identifier
261 1 CE_PORT=1 ;
*** ERROR C202 IN LINE 261 OF TEXT_FUN.C: 'CE_PORT': undefined identifier
262 1
263 1 }
264 //---------write 1 code to Lcm--------//
265 void write_code(unsigned char c)
266 {
267 1 while(st00_st01()==0);
268 1 CE_PORT=0 ;
*** ERROR C202 IN LINE 268 OF TEXT_FUN.C: 'CE_PORT': undefined identifier
269 1 CD_PORT=1 ;
*** ERROR C202 IN LINE 269 OF TEXT_FUN.C: 'CD_PORT': undefined identifier
270 1 //code
271 1 DATA_PORT=c ;
*** ERROR C202 IN LINE 271 OF TEXT_FUN.C: 'P0': undefined identifier
272 1 WR_PORT=0 ;
*** ERROR C202 IN LINE 272 OF TEXT_FUN.C: 'WR_PORT': undefined identifier
273 1 _nop_();
274 1 WR_PORT=1 ;
*** ERROR C202 IN LINE 274 OF TEXT_FUN.C: 'WR_PORT': undefined identifier
275 1 CE_PORT=1 ;
*** ERROR C202 IN LINE 275 OF TEXT_FUN.C: 'CE_PORT': undefined identifier
276 1 }
277
278
279 //-----------write data to lgd---------//
280 void write_to(unsigned char a)
281 {
282 1 while(st00_st01()==0);
283 1 CE_PORT=0 ;
*** ERROR C202 IN LINE 283 OF TEXT_FUN.C: 'CE_PORT': undefined identifier
284 1 CD_PORT=0 ;
*** ERROR C202 IN LINE 284 OF TEXT_FUN.C: 'CD_PORT': undefined identifier
285 1 //data
286 1 DATA_PORT=a ;
*** ERROR C202 IN LINE 286 OF TEXT_FUN.C: 'P0': undefined identifier
287 1 WR_PORT=0 ;
*** ERROR C202 IN LINE 287 OF TEXT_FUN.C: 'WR_PORT': undefined identifier
288 1 WR_PORT=1 ;
*** ERROR C202 IN LINE 288 OF TEXT_FUN.C: 'WR_PORT': undefined identifier
289 1 CE_PORT=1 ;
*** ERROR C202 IN LINE 289 OF TEXT_FUN.C: 'CE_PORT': undefined identifier
290 1 }
291
292 //---------- START THE LGD-----------//
293 void lcm_start(void)
294 {
295 1 //----setting the text head addr--------//
296 1 write_2_code(0x00,0x00,0x21);
297 1 //the light mark start
298 1 write_2_code(0x00,0x00,0x40);
299 1 //text start
300 1
301 1 write_2_code(0x1e,0x00,0x41);
302 1 //text with
303 1
304 1 write_2_code(0x00,0x00,0x42);
C51 COMPILER V7.50 TEXT_FUN 09/09/2005 18:17:34 PAGE 7
305 1 //graph start
306 1
307 1 write_2_code(0x1e,0x00,0x43);
308 1 //graph with
309 1
310 1 write_code(0xa1);
311 1 //the light mark look like
312 1
313 1 write_code(0x80);
314 1 // the text or graph
315 1
316 1 write_code(0x98);
317 1 //the show like
318 1
319 1 }
320
321 //--------------CLS THE LCM-----------------//
322 void cls_lcm(void)
323 {
324 1 unsigned int i ;
325 1
326 1 write_2_code(0x00,0x00,0x24);
327 1 write_code(0xb0);
328 1 for(i=0;i<5888;i++)
329 1 {
330 2 while(st03()==0);
331 2 write_to(0x00);
332 2
333 2 }
334 1 write_code(0xb2);
335 1 }
336
337
338
339 void chinese_show(unsigned char lin,unsigned char column,unsigned int hzcode)
340 {
341 1 unsigned char i ;
342 1 unsigned int startaddr ;
343 1 startaddr=(lin)*30+column ;
344 1 for(i=0;i<16;i++)
345 1 {
346 2 write_2_code((unsigned char)(startaddr),(unsigned char)(startaddr>>8),0x24);
347 2 write_1_code(tab2[hzcode][i*2],0xc0);
348 2 write_1_code(tab2[hzcode][i*2+1],0xc4);
349 2 startaddr=startaddr+30 ;
350 2 }
351 1
352 1 }
353
354 void show_pixel(unsigned int x,unsigned int y,bit mode)
355 {
356 1 unsigned int startaddr=0 ;
357 1 unsigned char dat ;
358 1 startaddr=x*30+y/8 ;
359 1 dat=0xf0+7-y%8 ;
360 1 if(mode)dat=dat|0x08 ;
361 1 write_2_code((unsigned char)(startaddr),(unsigned char)(startaddr>>8),0x24);
362 1
363 1 write_code(dat);
364 1 }
365
366 void show_line(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2,bit mode)
C51 COMPILER V7.50 TEXT_FUN 09/09/2005 18:17:34 PAGE 8
367 {
368 1 unsigned char x,y ;
369 1 double k,b ;
370 1 if(abs(y1-y2)<=abs(x1-x2))
371 1 {
372 2 k=(float)(y2-y1)/(float)(x2-x1);
373 2 b=y1-k*x1 ;
374 2 if(x1<=x2)
375 2 {
376 3 for(x=x1;x<=x2;x++)
377 3 {
378 4 y=k*x+b ;
379 4 show_pixel(x,y,mode);
380 4 }
381 3 }
382 2 else
383 2 {
384 3
385 3 for(x=x2;x<=x1;x++)
386 3 {
387 4 y=k*x+b ;
388 4 show_pixel(x,y,mode);
389 4 }
390 3 }
391 2
392 2
393 2 }
394 1 else
395 1 {
396 2
397 2 k=(float)(x2-x1)/(float)(y2-y1);
398 2 b=x1-k*y1 ;
399 2 if(y1<=y2)
400 2 {
401 3 for(y=y1;y<=y2;y++)
402 3 {
403 4 x=k*y+b ;
404 4 show_pixel(x,y,mode);
405 4 }
406 3 }
407 2 else
408 2 {
409 3
410 3 for(y=y2;y<=y1;y++)
411 3 {
412 4 x=k*y+b ;
413 4 show_pixel(x,y,mode);
414 4 }
415 3 }
416 2 }
417 1 }
418
419 void circle(unsigned char x0,unsigned char y0,unsigned char Rx, bit s)
420 {
421 1 unsigned int xx,rr,xt,yt,rs,row,col;
422 1 yt=Rx;
423 1 rr=Rx*Rx+1; //补偿 1 修正方形
424 1 rs=(yt+(yt>>1))>>1; //(*0.75)分开1/8圆弧来画
425 1 for (xt=0;xt<=rs;xt++)
426 1 {
427 2 xx=xt*xt;
428 2 while ((yt*yt)>(rr-xx))yt--;
C51 COMPILER V7.50 TEXT_FUN 09/09/2005 18:17:34 PAGE 9
429 2 row=x0+xt; //第一象限
430 2 col=y0-yt;
431 2 show_pixel(row,col,s);
432 2 row=x0-xt; //第二象限
433 2 show_pixel(row,col,s);
434 2 col=y0+yt; //第三象限
435 2 show_pixel(row,col,s);
436 2 row=x0+xt; //第四象限
437 2 show_pixel(row,col,s);
438 2
439 2 /***************45度镜象画另一半***************/
440 2
441 2 row=x0+yt; //第一象限
442 2 col=y0-xt;
443 2 show_pixel(row,col,s);
444 2 row=x0-yt; //第二象限
445 2 show_pixel(row,col,s);
446 2 col=y0+xt; //第三象限
447 2 show_pixel(row,col,s);
448 2 row=x0+yt; //第四象限
449 2 show_pixel(row,col,s);
450 2 }
451 1 }
452
453 //--------to draw the square in the lcm--------------//
454 void draw_Square(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2,bit mode)
455 {
456 1 unsigned char ii,jj;
457 1 unsigned int startaddr ;
458 1 startaddr=(y1)*30+x1 ;
459 1 for(jj=0;jj<abs(y2-y1);jj++)
460 1 {
461 2 write_2_code((unsigned char)(startaddr),(unsigned char)(startaddr>>8),0x24);
462 2 for(ii=0;ii<abs(x2-x1);ii++)
463 2 {
464 3 if(mode)
465 3 write_1_code(0xff,0xc0);
466 3 else write_1_code(0x00,0xc0);
467 3 }
468 2 startaddr+=30;
469 2 }
470 1
471 1
472 1 }
473
474 //----------the function is -----------//
475 void draw_NO_Square(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2,bit mode)
476 {
477 1 show_line(x1,y1,x2,y1,mode);
478 1 show_line(x2,y1,x2,y2,mode);
479 1 show_line(x1,y2,x2,y2,mode);
480 1 show_line(x1,y1,x1,y2,mode);
481 1 }
482 //-----------draw the ascii anti----//
483 void ASCII_Anti(unsigned char lin,unsigned char column)
484 {
485 1 unsigned char temp;
486 1 unsigned int startaddr;
487 1 unsigned char ii;
488 1 startaddr=lin*30+column;
489 1 for(ii=0;ii<16;ii++)
490 1 {
C51 COMPILER V7.50 TEXT_FUN 09/09/2005 18:17:34 PAGE 10
491 2 write_2_code((unsigned char)(startaddr),(unsigned char)(startaddr>>8),0x24);
492 2
493 2 write_code(0xc5);
494 2 temp=read_from();
495 2 temp=~temp;
496 2 write_1_code(temp,0xc0);
497 2
498 2 startaddr+=30;
499 2 }
500 1 }
501
502 //---------the function is chang the chinese to anti----------//
503 void chinese_anti(unsigned char lin,unsigned char column)
504 {
505 1 ASCII_Anti(lin,column);
506 1 ASCII_Anti(lin,column+1);
507 1 }
508
509
510 void login(void)
511 {
512 1 //unsigned char ii,jj;
513 1
514 1 draw_Square(10,30,30,100,1);
515 1 draw_Square(15,60,27,80,0);
516 1
517 1 }
518 //-----------text the function--------------------//
519 void text(void)
520 {
521 1 show_line(60,20,60,210,1);
522 1
523 1 chinese_show(8,0,17);
524 1 chinese_show(8,2,18);
525 1 chinese_show(8,4,19);
526 1
527 1 chinese_show(40,2,0);
528 1 chinese_show(40,4,1);
529 1 chinese_show(40,6,2);
530 1 chinese_show(40,8,3);
531 1 chinese_show(40,10,4);
532 1
533 1
534 1 chinese_show(40,12,10);
535 1 chinese_show(40,14,11);
536 1 chinese_show(40,16,12);
537 1 chinese_show(40,18,13);
538 1 chinese_show(40,20,14);
539 1 chinese_show(40,22,15);
540 1 chinese_show(40,24,16);
541 1
542 1 chinese_show(96,18,5);
543 1 chinese_show(96,20,6);
544 1 chinese_show(96,22,7);
545 1 chinese_show(96,24,8);
546 1 chinese_show(96,26,9);
547 1 circle(95,50,22,1);
548 1 circle(85,45,7,1);
549 1 circle(85,60,7,1);
550 1 circle(110,55,4,1);
551 1 draw_Square(5,10,10,20,0);
552 1 draw_NO_Square(60,20,30,210,1);
C51 COMPILER V7.50 TEXT_FUN 09/09/2005 18:17:34 PAGE 11
553 1 chinese_anti(96,26);
554 1 login();
555 1 }
C51 COMPILATION COMPLETE. 1 WARNING(S), 60 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -