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

📄 key.lst

📁 C51单片机一个小项目源程序:包含液晶12232驱动,AD7705驱动,按键扫描及单片机内部EEPROM的驱动,是一个比较值得参考的源程序
💻 LST
📖 第 1 页 / 共 3 页
字号:
 500   2                      //display_num1(84,1,k_max1a,1);
 501   2                      display_num(1,68,1,0,0,k_max1a);
 502   2                      dprintf(42,1,"000",0);
 503   2                      Turnaround_CornerORPower_Value3[0]=k_max1a/256;
 504   2                  Turnaround_CornerORPower_Value3[1]=k_max1a%256;
 505   2                  Turnaround_CornerORPower_Value3[2]=0;
 506   2                  Turnaround_CornerORPower_Value3[3]=0; 
 507   2               }
 508   1               if(Ch2k<Turnaround_Power_0)
 509   1               {
 510   2                  k_max1a=k_ch1a;
 511   2                      //display_num1(42,1,k_max1a,1);
 512   2                      display_num(1,26,1,0,0,k_max1a);
 513   2                      dprintf(84,1,"000",0);
 514   2                      Turnaround_CornerORPower_Value3[0]=0;
 515   2                  Turnaround_CornerORPower_Value3[1]=0;
 516   2                  Turnaround_CornerORPower_Value3[2]=k_max1a/256;
 517   2                  Turnaround_CornerORPower_Value3[3]=k_max1a%256; 
 518   2               }
 519   1               if(Ch2k==Turnaround_Power_0)
 520   1               {
 521   2                  dprintf(42,1,"000",0);
 522   2                  dprintf(84,1,"000",0);
 523   2                      Turnaround_CornerORPower_Value3[0]=0;
 524   2                  Turnaround_CornerORPower_Value3[1]=0;
 525   2                  Turnaround_CornerORPower_Value3[2]=0;
 526   2                  Turnaround_CornerORPower_Value3[3]=0;
 527   2               }      
 528   1                      SetSerio=1;
 529   1                      send_char(0xaa);                     //左转角
 530   1                      delay();
 531   1                      send_string_com(Turnaround_CornerORPower_Value2,2);
 532   1                      delay();
 533   1                      send_char(0xbb);                         //右转角
 534   1                      send_string_com(Turnaround_CornerORPower_Value2+2,2);
 535   1                      delay();
 536   1                      send_char(0xcc);                         //左转矩
 537   1                      delay();
 538   1                      send_string_com(Turnaround_CornerORPower_Value3,2);
 539   1                      delay();
 540   1                      send_char(0xdd);                          //右转矩
 541   1                      send_string_com(Turnaround_CornerORPower_Value3+2,2);
 542   1      
 543   1                      Turnaround_CornerORPower_Value2[0]=0;
 544   1                  Turnaround_CornerORPower_Value2[1]=0;
 545   1                      Turnaround_CornerORPower_Value2[2]=0;
 546   1                  Turnaround_CornerORPower_Value2[3]=0;
 547   1      
 548   1                      Turnaround_CornerORPower_Value3[0]=0;
 549   1                  Turnaround_CornerORPower_Value3[1]=0;
 550   1                      Turnaround_CornerORPower_Value3[2]=0;
 551   1                  Turnaround_CornerORPower_Value3[3]=0;
C51 COMPILER V7.50   KEY                                                                   09/26/2007 17:19:07 PAGE 10  

 552   1                      k_max1a=0;
 553   1      }
 554          
 555          uint filter_biaoding(bit CHX)
 556          {
 557   1         uint Read_Ad;
 558   1         //uchar i;
 559   1         long sum1;
 560   1         for(i=0;i<10;i++)
 561   1         {
 562   2             Read_Ad=ReadDataCh1_Ch2(CHX);
 563   2                 sum1+=Read_Ad;
 564   2                 Read_Ad=0;
 565   2         }
 566   1         //return (int)(sum/10.0);
 567   1         return (int)(sum1/10.0);
 568   1      } 
 569          
 570          void Test_Case_9()
 571          {
 572   1                                
 573   1                         draw_bmp(17,0,16,Biao);
 574   1                         draw_bmp(33,0,16,Ding);
 575   1                         draw_bmp(81,0,16,Zeng);
 576   1                         draw_bmp(97,0,16,Chang);
 577   1                         draw_bmp(0,1,16,Zhuan);
 578   1                         draw_bmp(15,1,16,Jue);
 579   1                         draw_bmp(65,1,16,Zhuan);
 580   1                         draw_bmp(81,1,16,Ju);                             
 581   1                        // if(serio_data==0xee)
 582   1      
 583   1                         Ch1k=Ch2k=0;
 584   1      
 585   1                 CH1_init();
 586   1                 Ch1k=filter(1);
 587   1      
 588   1                         //delay();
 589   1      
 590   1                         //CH2_init();
 591   1                 //Ch2k=filter(0);
 592   1                         if(Turnaround_Corner_360-Turnaround_Corner_0==0)
 593   1                         {
 594   2                             k_1=0;
 595   2                                 display_num(1,23,1,0,1,k_1);
 596   2                         }
 597   1                         else
 598   1                         {
 599   2                             Nt=(360.000*(abs(Ch1k-Turnaround_Corner_0)))/(abs(Turnaround_Corner_360-Turnaround_Corner_0));
 600   2                             k_1=(int)Nt;
 601   2                             display_num(1,23,1,0,1,k_1);
 602   2                             if(Ch1k>Turnaround_Corner_0)
 603   2                             {
 604   3                                 Turnaround_CornerValue1[0]=k_1/256;
 605   3                                     Turnaround_CornerValue1[1]=k_1%256;
 606   3                                     Turnaround_CornerValue1[2]=0;
 607   3                                     Turnaround_CornerValue1[3]=0; 
 608   3                              }
 609   2                             else 
 610   2                             {
 611   3                                 Turnaround_CornerValue1[2]=k_1/256;
 612   3                                     Turnaround_CornerValue1[3]=k_1%256;
 613   3                                     Turnaround_CornerValue1[0]=0;
C51 COMPILER V7.50   KEY                                                                   09/26/2007 17:19:07 PAGE 11  

 614   3                                     Turnaround_CornerValue1[1]=0;
 615   3                              }
 616   2                         }
 617   1      
 618   1                         CH2_init();
 619   1                 Ch2k=filter(0);
 620   1      
 621   1                         if(Turnaround_Power_200-Turnaround_Power_0==0)
 622   1                         {
 623   2                             k_1=0;
 624   2                                 display_num(1,81,1,0,0,k_1);
 625   2                         }
 626   1                         else
 627   1                         {
 628   2                             Nt=(40.000*(abs(Ch2k-Turnaround_Power_0)))/(abs(Turnaround_Power_200-Turnaround_Power_0));
 629   2                             k_1=(int)Nt;
 630   2                         //k_1=Turnaround_Power_200-Turnaround_Power_0;
 631   2                         //display_num1(97,1,k_1,1);
 632   2                                /* k_1=Turnaround_Power_0;
 633   2                                 display_num(1,0,0,1,1,k_1);
 634   2                                 k_1=Turnaround_Power_200;
 635   2                                 display_num(1,60,0,1,1,k_1);   */
 636   2      
 637   2                             display_num(1,81,1,0,0,k_1);
 638   2                             if(Ch2k>Turnaround_Power_0)
 639   2                             {
 640   3                                 Turnaround_Power_Value2[0]=k_1/256;
 641   3                                     Turnaround_Power_Value2[1]=k_1%256;
 642   3                                     Turnaround_Power_Value2[2]=0;
 643   3                                     Turnaround_Power_Value2[3]=0;
 644   3                             }
 645   2                             else 
 646   2                             {
 647   3                                 Turnaround_Power_Value2[2]=k_1/256;
 648   3                                     Turnaround_Power_Value2[3]=k_1%256;
 649   3                                     Turnaround_Power_Value2[0]=0;
 650   3                                     Turnaround_Power_Value2[1]=0; 
 651   3                              }
 652   2                         } 
 653   1                         //serio_data=0; 
 654   1                        
 655   1      }  
 656          
 657          void Test_Case_10()
 658          {
 659   1                dprintf(12,0,"与上位机通讯",0);
 660   1                         if(serio_data==0xee)
 661   1                {
 662   2                               send_char(0xaa);
 663   2                               send_string_com1(Turnaround_CornerValue1,2);
 664   2                               send_char(0xbb);
 665   2                               send_string_com1(Turnaround_CornerValue1+2,2);
 666   2                               send_char(0xcc);
 667   2                               send_string_com1(Turnaround_Power_Value2,2);
 668   2                               send_char(0xdd);
 669   2                               send_string_com1(Turnaround_Power_Value2+2,2);
 670   2                               delay();
 671   2                               serio_data=0;
 672   2                 }
 673   1        
 674   1                         draw_bmp(0,1,16,Zhuan);
 675   1                         draw_bmp(15,1,16,Jue);
C51 COMPILER V7.50   KEY                                                                   09/26/2007 17:19:07 PAGE 12  

 676   1                         draw_bmp(65,1,16,Zhuan);
 677   1                         draw_bmp(81,1,16,Ju);                             
 678   1                        // if(serio_data==0xee)
 679   1      
 680   1                         Ch1k=Ch2k=0;
 681   1                 CH1_init();
 682   1                 Ch1k=filter(1);
 683   1      
 684   1                         //delay();
 685   1      
 686   1                         CH2_init();
 687   1                 Ch2k=filter(0);
 688   1      
 689   1                         Nt=(360.000*(abs(Ch1k-Turnaround_Corner_0)))/(abs(Turnaround_Corner_360-Turnaround_Corner_0));
 690   1                         k_1=(int)Nt;
 691   1                         display_num(1,23,1,0,1,k_1);
 692   1                         if(Ch1k>Turnaround_Corner_0)
 693   1                         {
 694   2                             Turnaround_CornerValue1[0]=k_1/256;
 695   2                                 Turnaround_CornerValue1[1]=k_1%256;
 696   2                                 Turnaround_CornerValue1[2]=0;
 697   2                                 Turnaround_CornerValue1[3]=0; 
 698   2                         }
 699   1                         else 
 700   1                         {
 701   2                             Turnaround_CornerValue1[2]=k_1/256;
 702   2                                 Turnaround_CornerValue1[3]=k_1%256;
 703   2                                 Turnaround_CornerValue1[0]=0;
 704   2                                 Turnaround_CornerValue1[1]=0;
 705   2                         }
 706   1                         Nt=(40.000*(abs(Ch2k-Turnaround_Power_0)))/(abs(Turnaround_Power_200-Turnaround_Power_0));
 707   1                         k_1=(int)Nt;
 708   1                         //display_num1(97,1,k_1,1);
 709   1                         display_num(1,81,1,0,0,k_1);
 710   1                         if(Ch2k>Turnaround_Power_0)
 711   1                         {
 712   2                             Turnaround_Power_Value2[0]=k_1/256;
 713   2                                 Turnaround_Power_Value2[1]=k_1%256;
 714   2                                 Turnaround_Power_Value2[2]=0;
 715   2                                 Turnaround_Power_Value2[3]=0;
 716   2                         }
 717   1                         else 
 718   1                         {
 719   2                             Turnaround_Power_Value2[2]=k_1/256;
 720   2                                 Turnaround_Power_Value2[3]=k_1%256;
 721   2                                 Turnaround_Power_Value2[0]=0;
 722   2                                 Turnaround_Power_Value2[1]=0; 
 723   2                         }
 724   1                         //serio_data=0; 
 725   1                        
 726   1      }      
 727          
 728          
 729          
 730          
 731          
 732          
 733          
 734          
 735          
 736          
 737          
C51 COMPILER V7.50   KEY                                                                   09/26/2007 17:19:07 PAGE 13  

 738          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   5075    ----
   CONSTANT SIZE    =     34    ----
   XDATA SIZE       =     95       5
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      3    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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