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

📄 lcdx1.lst

📁 此程序主要测试50HZ~3KHZ音频范围幅频特性测试程序.程序包含主控程序和显示程序.
💻 LST
📖 第 1 页 / 共 5 页
字号:
 476   4                              }
 477   3                      }
 478   2              }
 479   1              else
 480   1              {
 481   2                      d_x=psta.x-pend.x;
 482   2                      if(d_x>=d_y)
 483   2                      {
 484   3                              if(d_y==0) psta.y--;
 485   3                              for(psta.x--;psta.x!=pend.x-1;psta.x--)
 486   3                              {
 487   4                                      if(err<0)
 488   4                                      {                               
 489   5                                              err=err+d_y;
C51 COMPILER V7.07   LCDX1                                                                 01/25/2005 13:50:05 PAGE 9   

 490   5                                      }
 491   4                                      else
 492   4                                      {
 493   5                                              psta.y++;
 494   5                                              err=err+d_y-d_x;
 495   5                                      }
 496   4                                      disp_one_dot(psta,s);
 497   4                              }
 498   3                      }
 499   2                      else
 500   2                      {
 501   3                              for(psta.y++;psta.y<=pend.y;psta.y++)
 502   3                              {
 503   4                                      if(err>=0)
 504   4                                      {
 505   5                                              err=err-d_x;
 506   5                                      }
 507   4                                      else
 508   4                                      {
 509   5                                              psta.x--;
 510   5                                      }
 511   4                                      disp_one_dot(psta,s);
 512   4                              }
 513   3                      }
 514   2              }
 515   1      }
 516          
 517          /*绘制一般矩形,其中firp与othp分别为矩形的对角两点坐标,
 518          s=1显示矩形,s=0时清除矩形*/
 519          void draw_rec(point firp,point othp,bit s)
 520          {
 521   1              point a;
 522   1              a.x=firp.x;
 523   1              a.y=othp.y;
 524   1              draw_line(firp,a,s);
 525   1              draw_line(othp,a,s);
 526   1              a.x=othp.x;
 527   1              a.y=firp.y;
 528   1              draw_line(firp,a,s);
 529   1              draw_line(othp,a,s);
 530   1      }
 531          
 532          /*p1,p2点指定的矩形区域置1(s=0xff),清除(s=0),其它则取反*/
 533          /*从下到上,从左到右进行刷新*/
 534          
 535          void draw_srec(point p1,point p2,uchar s)
 536          {
 537   1              uchar a,i,j,min,max;
 538   1              if(p1.x>p2.x) {a=p1.x;p1.x=p2.x;p2.x=a;}
 539   1              if(p1.y>p2.y) {a=p1.y;p1.y=p2.y;p2.y=a;}
 540   1              if((p1.x<128)&(p1.y<64))
 541   1              {
 542   2                      if(p2.x>127) p2.x=127;
 543   2                      if(p2.y>63) p2.y=63;
 544   2                      min=MIN(p1.y/8,p2.y/8);
 545   2                      max=MAX(p1.y/8,p2.y/8);
 546   2                      for(i=max+1;i>=min+1;i--)
 547   2                      {
 548   3                                              
 549   3                              for(j=p1.x;j<=p2.x;j++)
 550   3                              {
 551   4                                      if(j<=63)                               
C51 COMPILER V7.07   LCDX1                                                                 01/25/2005 13:50:05 PAGE 10  

 552   4                                      {
 553   5                                              iwl(0xb8|(i-1));
 554   5                                              iwl(0x40|j);
 555   5                                              a=drl();
 556   5                                              a=drl();
 557   5                                              iwl(0x40|j);
 558   5                                              if(min!=max)            
 559   5                                              {
 560   6                                                      if(i==min+1)
 561   6                                                      {
 562   7                                                              if(s==0) dwl(a&(0xff>>(8-p1.y%8)));
 563   7                                                              else if(s==0xff) dwl(a|(0xff<<(p1.y%8)));
 564   7                                                              else {dwl(a^(0xff<<(p1.y%8)));}
 565   7                                                      }
 566   6                                                      else if(i==max+1)
 567   6                                                      {
 568   7                                                              if(s==0) dwl(a&(0xff<<(p2.y%8+1)));
 569   7                                                              else if(s==0xff) dwl(a|(0xff>>(7-p2.y%8)));
 570   7                                                              else {dwl(a^(0xff>>(7-p2.y%8)));}
 571   7                                                      }
 572   6                                                      else 
 573   6                                                      {
 574   7                                                              if(s==0) {dwl(0);}
 575   7                                                              else if(s==0xff) {dwl(0xff);}
 576   7                                                              else {dwl(~a);}
 577   7                                                      }
 578   6                                              }
 579   5                                              else
 580   5                                              {
 581   6                                                      if(s==0) dwl(a&((0xff>>(8-p1.y%8))|(0xff<<(p2.y%8+1))));
 582   6                                                      else if(s==0xff) dwl(a|((0xff<<(p1.y%8))&(0xff>>(7-p2.y%8))));
 583   6                                                      else {dwl(a^((0xff<<(p1.y%8))&(0xff>>(7-p2.y%8))));}
 584   6                                              }
 585   5                                      }
 586   4                                      else                    
 587   4                                      {
 588   5                                              iwr(0xb8|(i-1));
 589   5                                              iwr(0x40|(j-64));
 590   5                                              a=drr();
 591   5                                              a=drr();
 592   5                                              iwr(0x40|(j-64));
 593   5                                              if(min!=max)
 594   5                                              {
 595   6                                                      
 596   6                                                      if(i==min+1)
 597   6                                                      {
 598   7                                                              if(s==0) {dwr(a&(0xff>>(8-p1.y%8)));}
 599   7                                                              else if(s==0xff) {dwr(a|(0xff<<(p1.y%8)));}
 600   7                                                              else {dwr(a^(0xff<<(p1.y%8)));}
 601   7                                                      }
 602   6                                                      else if(i==max+1)
 603   6                                                      {
 604   7                                                              if(s==0) {dwr(a&(0xff<<(p2.y%8+1)));}
 605   7                                                              else if(s==0xff) {dwr(a|(0xff>>(7-p2.y%8)));}
 606   7                                                              else {dwr(a^(0xff>>(7-p2.y%8)));}
 607   7                                                      }
 608   6                                                      else 
 609   6                                                      {
 610   7                                                              if(s==0) {dwr(0);}
 611   7                                                              else if(s==0xff) {dwr(0xff);}
 612   7                                                              else {dwr(~a);}
 613   7                                                      }
C51 COMPILER V7.07   LCDX1                                                                 01/25/2005 13:50:05 PAGE 11  

 614   6                                              }
 615   5                                              else
 616   5                                              {
 617   6                                                      if(s==0) dwr(a&((0xff>>(8-p1.y%8))|(0xff<<(p2.y%8+1))));
 618   6                                                      else if(s==0xff) dwr(a|((0xff<<(p1.y%8))&(0xff>>(7-p2.y%8))));
 619   6                                                      else {dwr(a^((0xff<<(p1.y%8))&(0xff>>(7-p2.y%8))));}
 620   6                                              }
 621   5                                      }
 622   4                              }
 623   3                      }
 624   2              }
 625   1      }
 626          
 627          /*将8位的字模数据写入光标指定的位置进行显示*/
 628          void disp_one_modu(uchar m)
 629          {
 630   1              uchar a;
 631   1              if((cursor.x<128)&&(cursor.y<64))
 632   1              {
 633   2                      if(cursor.x<=63)
 634   2                      {
 635   3                              iwl(0xb8|cursor.y/8);
 636   3                              iwl(0x40|cursor.x);
 637   3                              a=drl();
 638   3                              a=drl();
 639   3                              iwl(0x40|cursor.x);
 640   3                              dwl((m<<(cursor.y%8))|(a&(0xff>>(8-cursor.y%8))));
 641   3                              if((cursor.y+8)<64)
 642   3                              {
 643   4                                      iwl(0xb8|(cursor.y+8)/8);
 644   4                                      iwl(0x40|cursor.x);
 645   4                                      a=drl();
 646   4                                      a=drl();
 647   4                                      iwl(0x40|cursor.x);
 648   4                                      dwl((a&(0xff<<(cursor.y%8)))|(m>>(8-cursor.y%8)));
 649   4                              }
 650   3                      }
 651   2                      else
 652   2                      {
 653   3                              iwr(0xb8|cursor.y/8);
 654   3                              iwr(0x40|(cursor.x-64));
 655   3                              a=drr();
 656   3                              a=drr();
 657   3                              iwr(0x40|(cursor.x-64));
 658   3                              dwr((m<<(cursor.y%8))|(a&(0xff>>(8-cursor.y%8))));
 659   3                              if((cursor.y+8)<64)
 660   3                              {               
 661   4                                      iwr(0xb8|(cursor.y+8)/8);
 662   4                                      iwr(0x40|(cursor.x-64));
 663   4                                      a=drr();
 664   4                                      a=drr();
 665   4                                      iwr(0x40|(cursor.x-64));
 666   4                                      dwr((a&(0xff<<(cursor.y%8)))|(m>>(8-cursor.y%8)));
 667   4                              }
 668   3                      }
 669   2              }
 670   1              else
 671   1              {
 672   2                      if(cursor.x>=128) zf_ovx=1;
 673   2                      if(cursor.y>=64) zf_ovy=1;
 674   2              }
 675   1      }
C51 COMPILER V7.07   LCDX1                                                                 01/25/2005 13:50:05 PAGE 12  

 676          
 677          /*在光标处显示一个汉字,n是字库中的位置,width表示字符的宽度,pt为字库首地址,s为1表示正显,为0表示反显*/
 678          void disp_one_hz(uchar n,uchar width,uchar code *pt,bit s)
 679          {
 680   1              uchar a,i;
 681   1              uint b;
 682   1              a=cursor.x;
 683   1              zf_ovx=0;
 684   1              zf_ovy=0;
 685   1              for(i=0;i<width;i++)
 686   1              {
 687   2                      if(zf_ovx==0) {b=i+n*(width<<1);disp_one_modu(s?*(pt+b):~(*(pt+b)));}
 688   2                      cursor.x++;
 689   2                      if(cursor.x==128) zf_ovx=1;
 690   2              }
 691   1              zf_ovx=0;
 692   1              if((cursor.y+8)<64)
 693   1              {
 694   2                      cursor.x=a;
 695   2                      a=cursor.y;
 696   2                      cursor.y+=8;
 697   2              for(i=width;i<(width<<1);i++)
 698   2              {
 699   3                      if(zf_ovx==0) {b=i+n*(width<<1);disp_one_modu(s?*(pt+b):~(*(pt+b)));}
 700   3                      cursor.x++;
 701   3                      if(cursor.x==128) zf_ovx=1;
 702   3              }
 703   2              }
 704   1              cursor.y=a;
 705   1              zf_ovx=0;
 706   1              zf_ovy=0;
 707   1      }
 708          
 709          /*显示电量指示的外框;s=0清除,s=1显示*/
 710          void disp_bat_edge(bit s)
 711          {
 712   1              point p1,p2;
 713   1              p1.x=93+5;
 714   1              p1.y=00;
 715   1              p2.x=110+5;
 716   1              p2.y=7;

⌨️ 快捷键说明

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