⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcu_test.lst

📁 c /c++的智能VGA控制资料。值得大家一看!!
💻 LST
📖 第 1 页 / 共 3 页
字号:
 400   2          else if((cnt==4)&& (ch<100)) 
 401   2              {
 402   3                        
 403   3                        mouse_buf[cnt]=ch;
 404   3                        cnt=0;
 405   3                        mouse_x=mouse_buf[1]*100+mouse_buf[2];
 406   3                        mouse_y=mouse_buf[3]*100+mouse_buf[4];
 407   3                        break;
 408   3              }
 409   2              else {cnt=0;}
 410   2        }
 411   1      }
 412          /*
 413          ******************************************************************
 414          *
 415          * 名称:    MCU_Draw_ClearScreen()
 416          * 功能:    用指定的颜色清屏。
 417          * 入口参数:清屏颜色
 418          ******************************************************************
 419          */
 420          void  MCU_Mouse(uint8 en)
 421          {
 422   1              write_byte(0x81);  //指令开始 
 423   1              if(en) write_byte(0x40);  //指令代码
 424   1              else   write_byte(0x41);  //指令代码
 425   1              write_byte(0x84);    //指令结束 
 426   1      } 
 427          /*
C51 COMPILER V8.02   MCU_TEST                                                              03/31/2009 13:10:27 PAGE 8   

 428          */
 429           
 430          /********************************************
 431          定义数据常量,这些数据在实际应用中一般由A/D转换器采样所得到。
 432          这里的每一个字节代表一个Y轴坐标的大小即幅度。
 433          **********************************************/
 434          
 435          unsigned short code y_data1[110] = {
 436            0x0b,0x0b,0x0b,0x0b,0x0b,
 437            0x0b,0x0b,0x0b,0x0b,0x0b,
 438            0x0b,0x0b,0x0b,0x0b,0x0b,
 439            0x1c,0x1c,0x1c,0x1c,0x1c,
 440            0x1c,0x1c,0x1c,0x1c,0x1c,
 441            0x1c,0x1c,0x1c,0x1c,0x1c,
 442            0x1c,0x1c,0x1c,0x1c,0x1c,
 443            0x00,0x00,0x00,0x00,0x00,
 444            0x00,0x00,0x00,0x00,0x00,
 445            0x00,0x00,0x00,0x00,0x00,
 446            0x00,0x00,0x00,0x00,0x00,
 447            0x50,0x50,0x50,0x50,0x50,
 448            0x50,0x50,0x50,0x50,0x50,
 449            0x50,0x50,0x50,0x50,0x50,
 450            0x50,0x50,0x50,0x50,0x50,
 451            0x50,0x50,0x50,0x50,0x50,
 452            0x48,0x46,0x44,0x42,0x40,
 453            0x3e,0x3c,0x3a,0x38,0x36,
 454            0x34,0x32,0x30,0x2e,0x2c,
 455            0x2a,0x28,0x26,0x24,0x22,
 456            0x20,0x1e,0x1c,0x1a,0x18,
 457            0x16,0x14,0x12,0x10,0x84
 458            };
 459            
 460          unsigned short code y_data2[110] = {
 461            0x015e,0x015e,0x015e,0x015e,0x015e,
 462            0x015e,0x015e,0x015e,0x015e,0x015e,
 463            0x015e,0x015e,0x015e,0x015e,0x015e,
 464            0x015e,0x015e,0x015e,0x015e,0x015e,
 465            0x015e,0x015e,0x015e,0x015e,0x015e,
 466            0x015e,0x015e,0x015e,0x015e,0x015e,
 467            0x015e,0x015e,0x015e,0x015e,0x015e,
 468            0x00,0x00,0x00,0x00,0x00,
 469            0x00,0x00,0x00,0x00,0x00,
 470            0x00,0x00,0x00,0x00,0x00,
 471            0x00,0x00,0x00,0x00,0x00,
 472            0x0084,0x0084,0x0084,0x0084,0x0084,
 473            0x0084,0x0084,0x0084,0x0084,0x0084,
 474            0x0084,0x0084,0x0084,0x0084,0x0084,
 475            0x0084,0x0084,0x0084,0x0084,0x0084,
 476            0x0084,0x0084,0x0084,0x0084,0x0084,
 477            0x48,0x46,0x44,0x42,0x40,
 478            0x3e,0x3c,0x3a,0x38,0x36,
 479            0x34,0x32,0x30,0x2e,0x2c,
 480            0x2a,0x28,0x26,0x24,0x22,
 481            0x20,0x1e,0x1c,0x1a,0x18,
 482            0x16,0x14,0x12,0x10,0xffff
 483            };     
 484           //下面是图片的排序号。它是一个头文件,需将其加入到您的程序中。
 485          #define        background            0
 486          #define        BiaoTi_0              1
 487          #define        BiaoTi_1              2
 488          #define        product               3
 489          #define        wave                  4
C51 COMPILER V8.02   MCU_TEST                                                              03/31/2009 13:10:27 PAGE 9   

 490          void main(void)     
 491          { 
 492   1          uint16 delay;
 493   1      
 494   1              for(delay=0;delay<65530;delay++);//延迟一点时间,等待智能VGA控制板初始化完毕    
 495   1      
 496   1          InitUART();
 497   1              
 498   1              
 499   1              Fcolor.B=191;      Fcolor.G=188;       Fcolor.R=192;
 500   1              MCU_Draw_ClearScreen();
 501   1          MCU_Draw_Pic(0,0,background);
 502   1              MCU_Draw_Pic_Auto(0,0,BiaoTi_0,BiaoTi_1,25);
 503   1              
 504   1      
 505   1              MCU_Mouse(1);            //打开鼠标功能 
 506   1        
 507   1              
 508   1        while(1)
 509   1        {
 510   2          Wait_MouseKeyDown();  //等待鼠标或触摸屏按下并获取按下时的坐标
 511   2      
 512   2              if((mouse_x>0)&&(mouse_x<156))
 513   2              {
 514   3                 if((mouse_y>208)&&(mouse_y<288))
 515   3                 {
 516   4                    Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0x0;
 517   4                MCU_Draw_RectangleFill(156,208,868,560);
 518   4                    Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0xff;
 519   4                MCU_Draw_LineWith(208,308,558,488,1);         //画线
 520   4                MCU_Draw_LineWith(558,308,208,488,1);         //画线  
 521   4                 }
 522   3       
 523   3                 if((mouse_y>288)&&(mouse_y<368))
 524   3                 {
 525   4                    Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0x0;
 526   4                MCU_Draw_RectangleFill(156,208,868,560);
 527   4                        Fcolor.B=0;      Fcolor.G=0xff;       Fcolor.R=0;
 528   4                MCU_Draw_Rectangle(650,300,100,180);          //矩形
 529   4                MCU_Draw_RectangleFill(850,300,100,180);      //填充矩形  
 530   4                 }
 531   3      
 532   3                 if((mouse_y>368)&&(mouse_y<448))
 533   3                 {
 534   4                    Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0x0;
 535   4                MCU_Draw_RectangleFill(156,208,868,560);
 536   4                        Fcolor.B=0;      Fcolor.G=0xff;       Fcolor.R=0;
 537   4                MCU_Draw_CircleFill(270,648,88,88);         //填充正圆
 538   4                MCU_Draw_Circle(460,648,88);                  //正圆
 539   4                 }
 540   3      
 541   3                 if((mouse_y>448)&&(mouse_y<528))
 542   3                 {
 543   4                    Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0x0;
 544   4                MCU_Draw_RectangleFill(156,208,868,560);
 545   4                    Fcolor.B=0xff;      Fcolor.G=0xff;       Fcolor.R=0;
 546   4                MCU_Draw_CircleFill(698,648,60,100);          //填充椭圆
 547   4                MCU_Draw_CircleFill(915,648,60,100);          //填充椭圆 
 548   4                 }
 549   3      
 550   3                 if((mouse_y>528)&&(mouse_y<608))
 551   3                 {  
C51 COMPILER V8.02   MCU_TEST                                                              03/31/2009 13:10:27 PAGE 10  

 552   4                    Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0x0;
 553   4                MCU_Draw_RectangleFill(156,208,868,560);
 554   4                    Fcolor.B=0xff;      Fcolor.G=0xff;       Fcolor.R=0;
 555   4                MCU_Draw_Wave(200,80,1,y_data1);                      //波形1
 556   4                MCU_Draw_Wave(700,80,2,y_data2);              //波形2
 557   4                 }
 558   3      
 559   3                 if((mouse_y>608)&&(mouse_y<688))
 560   3                 {
 561   4                    
 562   4                        Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0x0;
 563   4                MCU_Draw_RectangleFill(156,208,868,560);
 564   4                        Bcolor=Fcolor;
 565   4                    Fcolor.B=0xff;      Fcolor.G=0xff;       Fcolor.R=0xff;
 566   4                        
 567   4                MCU_Draw_String(208,250,0,"欢迎使用EasyVGA(12点阵)");
 568   4                MCU_Draw_String(208,273,1,"欢迎使用EasyVGA(16点阵)");
 569   4                        MCU_Draw_String(208,338,2,"欢迎使用EasyVGA(24点阵)"); 
 570   4                MCU_Draw_String(208,403,3,"欢迎使用EasyVGA(32点阵)");
 571   4                MCU_Draw_String(208,468,4,"欢迎使用EasyVGA(40点阵)");
 572   4                        MCU_Draw_String(208,550,5,"欢迎使用EasyVGA(48点阵)"); 
 573   4                        MCU_Draw_String(208,630,6,"欢迎使用EasyVGA(64点阵)");                 
 574   4      
 575   4                 }
 576   3        
 577   3                 if((mouse_y>688)&&(mouse_y<767))
 578   3                 {
 579   4                    Fcolor.B=0x0;      Fcolor.G=0x0;       Fcolor.R=0x0;          
 580   4                    MCU_Draw_Pic(156,208,product);
 581   4                        //MCU_Draw_Pic_Step(698,518,wheel_0,wheel_1,25);
 582   4                 }
 583   3              }
 584   2        }
 585   1       
 586   1          while(1);
 587   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2160    ----
   CONSTANT SIZE    =    622    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     16      82
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -