📄 venus.lst
字号:
*** WARNING C214 IN LINE 375 OF VENUS.C: 'Argument': conversion: non-pointer to pointer
376 2 k=lcd_ram_addr;
377 2 lcd_ram_addr=lcd_ram_addr+2; //下一个汉字地址
378 2 j=0;
379 2 while (j<32)
380 2 {
381 3 lcd_busy();
382 3 Lcd_Data_Port=k%256; //地址低位
383 3 lcd_busy();
384 3 Lcd_Data_Port=k/256; //地址高位
385 3 lcd_busy();
386 3 Lcd_Code_Port=0x24; //SET ADDRESS POINTER
387 3 lcd_busy();
388 3 Lcd_Data_Port=~font_data[j];
389 3 lcd_busy();
390 3 Lcd_Code_Port=0xc0;
391 3 j++;
392 3 lcd_busy();
393 3 Lcd_Data_Port=~font_data[j];
394 3 lcd_busy();
395 3 Lcd_Code_Port=0xc0;
396 3 j++;
397 3 k=k+lcd_graphic_columns;
398 3 }
399 2 i++;
400 2 }
401 1 }
402 print_e(unsigned int lcd_ram_addr) //显示英文字符串
403 {
404 1 unsigned char i;
405 1 lcd_ram_addr=lcd_ram_addr+0xf00; //写到文本区
406 1 i=0;
407 1 lcd_busy();
408 1 Lcd_Data_Port=lcd_ram_addr%256; //地址低位
409 1 lcd_busy();
410 1 Lcd_Data_Port=lcd_ram_addr/256; //地址高位
411 1 lcd_busy();
412 1 Lcd_Code_Port=0x24; //SET ADDRESS POINTER
413 1 while (lcd_buf[i]!=0xff)
414 1 {
415 2 lcd_busy();
416 2 Lcd_Data_Port=lcd_buf[i];
417 2 lcd_busy();
418 2 Lcd_Code_Port=0xc0;
419 2 i++;
420 2 }
421 1 }
422 print_fill(unsigned int lcd_ram_addr,unsigned char filldata,width,length)
C51 COMPILER V7.02b VENUS 01/18/2005 21:43:57 PAGE 8
423 {
424 1 unsigned char j;
425 1 while (width>0)
426 1 {
427 2 lcd_busy();
428 2 Lcd_Data_Port=lcd_ram_addr%256; //地址低位
429 2 lcd_busy();
430 2 Lcd_Data_Port=lcd_ram_addr/256; //地址高位
431 2 lcd_busy();
432 2 Lcd_Code_Port=0x24; //SET ADDRESS POINTER
433 2 j=length;
434 2 while (j>0)
435 2 {
436 3 lcd_busy();
437 3 Lcd_Data_Port=filldata;
438 3 lcd_busy();
439 3 Lcd_Code_Port=0xc0;
440 3 j--;
441 3 }
442 2 lcd_ram_addr=lcd_ram_addr+lcd_graphic_columns;
443 2 width--;
444 2 }
445 1 }
446 reset_flash()
447 {
448 1 unsigned char xdata *app;
449 1 EA=0; //关中断
450 1 Flash_Page=0x80;
451 1 *app=0xf0; //任意地址写0xf0复位flash
452 1 Flash_Page=Flash_Reg;
453 1 EA=1; //开中断
454 1 }
455 erase_flash(unsigned char sector)
456 {
457 1 unsigned char xdata *app;
458 1 EA=0; //关中断
459 1 Flash_Page=0x80;
460 1 if (sector==64)
461 1 {
462 2 app=0x555;
463 2 *app=0xaa;
464 2 app=0x2aa;
465 2 *app=0x55;
466 2 app=0x555;
467 2 *app=0x80;
468 2 *app=0xaa;
469 2 app=0x2aa;
470 2 *app=0x55;
471 2 app=0x555;
472 2 *app=0x10;
473 2 goto erase_ret;
474 2 }
475 1 if (sector<64)
476 1 {
477 2 app=0x555;
478 2 *app=0xaa;
479 2 app=0x2aa;
480 2 *app=0x55;
481 2 app=0x555;
482 2 *app=0x80;
483 2 *app=0xaa;
484 2 app=0x2aa;
C51 COMPILER V7.02b VENUS 01/18/2005 21:43:57 PAGE 9
485 2 *app=0x55;
486 2 app=sector;
487 2 *app=0x30;
488 2 }
489 1 erase_ret:
490 1 Flash_Page=Flash_Reg;
491 1 EA=1; //开中断
492 1 }
493 program_flash(unsigned int k,unsigned char x)
494 {
495 1 unsigned char xdata *app;
496 1 EA=0; //关中断
497 1 Flash_Page=0x80|Flash_Reg;
498 1 app=0x555;
499 1 *app=0xaa;
500 1 app=0x2aa;
501 1 *app=0x55;
502 1 app=0x555;
503 1 *app=0xa0;
504 1 app=k;
505 1 *app=x;
506 1 Flash_Page=Flash_Reg;
507 1 EA=1; //开中断
508 1 }
509 com_a_fs(unsigned int k)
510 //参数k为发送缓冲区首地址,要求缓冲区first字节空着,second和third字节为发送数据长度N
511 //second字节为长度高字节,third字节为长度低字节,从fouth字节开始存放N字节数据
512 {
513 1 txa_point=k; //设置发送指针
514 1 *txa_point=0x55; //验证头
515 1 txa_point++;
516 1 txa_lenth=(*txa_point)*256; //长度高字节
517 1 txa_point++;
518 1 txa_lenth=txa_lenth+(*txa_point); //长度低字节
519 1 txa_point=k; //设置发送指针
520 1 txa_lenth=txa_lenth+3;//发送长度(包括1字节验证头,2字节接收长度"N"和N字节数据)-->N+3
521 1 com_reg[2]=0x05; //CRA 打开发送通道A
522 1 com_reg[3]=0xaa; //THRA 启动头
523 1 txa_en=1; //允许发送
524 1 }
525 com_b_fs(unsigned int k)
526 //参数k为发送缓冲区首地址,要求缓冲区first字节空着,second和third字节为发送数据长度N
527 //second字节为长度高字节,third字节为长度低字节,从fouth字节开始存放N字节数据
528 {
529 1 txb_point=k; //设置发送指针
530 1 *txb_point=0x55; //验证头
531 1 txb_point++;
532 1 txb_length=(*txb_point)*256; //长度高字节
533 1 txb_point++;
534 1 txb_length=txb_length+(*txb_point); //长度低字节
535 1 txb_point=k; //设置发送指针
536 1 txb_length=txb_length+3;//发送长度(包括1字节验证头,2字节接收长度"N"和N字节数据)-->N+3
537 1 com_reg[10]=0x05; //CRB 打开发送通道B
538 1 com_reg[11]=0xaa; //THRB 启动头
539 1 txb_en=1; //允许发送
540 1 }
541 unsigned char key(unsigned char y)
542 {
543 1 if (P10==0) {;}
544 1 else if (P11==0) {y++;}
545 1 else if (P12==0) {y++;y++;}
546 1 else if (P13==0) {y++;y++;y++;}
C51 COMPILER V7.02b VENUS 01/18/2005 21:43:57 PAGE 10
547 1 else {y=0xFF;}
548 1 return(y);
549 1 }
550 unsigned char getchar() //4*4阵列键盘接P1口
551 {
552 1 unsigned char const keyname[16]={1,2,3,CLEAR,
553 1 4,5,6,ESC,
554 1 7,8,9,ENTER,
555 1 0,POINT,LEFT,RIGHT};
556 1 unsigned char x,y;
557 1 unsigned int k;
558 1 NOKEY:
559 1 P1=0xF;
560 1 x=0x0;
561 1 while (x==0x0) //等待按键
562 1 {
563 2 x=P1;
564 2 x=~x;
565 2 x=x&0xF;
566 2 if (rxa_ok) {goto GETKEY;}
567 2 }
568 1 for (k=0;k<5000;k++) {;} //延时消抖动
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -