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

📄 pinlvji2.lst

📁 频率计 闸门时间0.1s 1s 10s 频率范围0~99khz 可以切换 里面有四个源程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 175          unsigned long x; 
 176          uchar xPos,yPos; 
 177          uchar i; 
 178          
 179          
C51 COMPILER V7.50   PINLVJI2                                                              10/26/2008 13:12:27 PAGE 4   

 180          void main(void) 
 181          { 
 182   1          RstLcd();        //初始化LCD 
 183   1          ClrLcd();        //清屏 
 184   1          SetCur(1);    //开光标显示、闪烁 
 185   1          WriteString(s,0,0); 
 186   1          WriteString(s1,0,1); 
 187   1          WriteString(s2,0,1); 
 188   1           
 189   1          TMOD=0x15;                 //T0工作为16位计数器(方式1),T1工作方式为16位定时器 
 190   1          TH0=0;                     //计数为65536                      
 191   1          TL0=0;                     // 
 192   1          TH1=(65536-50000)/256;     //定时器采用定时50ms.  初值为50000 
 193   1          TL1=(65536-50000)%256; 
 194   1          TR1=1;                    //TR1=1,控制开关闭合,计数脉冲进入T1计数器,启动定时 
 195   1          TR0=1;                    //TR0=1,控制开关闭合,计数脉冲进入T1计数器,启动计数 
 196   1          ET0=1;                    //定时器0开中断 
 197   1          ET1=1;                    //定时器1开中断 
 198   1          EA=1;                     //CPU开中断 
 199   1      
 200   1      while(1) 
 201   1      {     
 202   2          if(KEY==0)
 203   2               {
 204   3                mDelay(10);
 205   3                 if(KEY==0)
 206   3                 {
 207   4              mark++;
 208   4                      if(mark==4)
 209   4                      mark=1;
 210   4                  while(~KEY);
 211   4                 }
 212   3           } 
 213   2        if(flag==1)                 
 214   2          { 
 215   3              flag=0;                        //清标志位 
 216   3              if(mark==1)
 217   3                      {
 218   4                      x=(T0count*65536+TH0*256+TL0)*10;   //取得时间宽度参数 
 219   4              LcdPos(15,1); 
 220   4                 WriteString(s1,0,1);
 221   4                 WriteChar(table1[(x%100000)%10000%1000%100%10],11,1);
 222   4                 WriteChar(table1[(x%100000)%10000%1000%100/10],10,1);    
 223   4                 WriteChar(table1[(x%100000)%10000%1000/100],9,1);    
 224   4                 WriteChar(table1[(x%100000)%10000/1000],8,1);    
 225   4                 WriteChar(table1[(x%100000)/10000],7,1);    
 226   4                 WriteChar(table1[(x/100000)],6,1);
 227   4                 WriteString(s,0,0);
 228   4                 WriteChar(0x30,0,0);
 229   4                         WriteChar(0x2e,1,0);
 230   4                         WriteChar(0x31,2,0);
 231   4                         WriteChar(0x53,3,0);
 232   4                 if(x>99999)
 233   4                         {
 234   5                          WriteString(s2,0,1);
 235   5                         }
 236   4               } 
 237   3         if(mark==2)
 238   3                      {
 239   4                      x=T0count*65536+TH0*256+TL0;   //取得时间宽度参数 
 240   4              LcdPos(15,1); 
 241   4                 WriteString(s1,0,1);
C51 COMPILER V7.50   PINLVJI2                                                              10/26/2008 13:12:27 PAGE 5   

 242   4                 WriteChar(table1[(x%100000)%10000%1000%100%10],11,1);
 243   4                 WriteChar(table1[(x%100000)%10000%1000%100/10],10,1);    
 244   4                 WriteChar(table1[(x%100000)%10000%1000/100],9,1);    
 245   4                 WriteChar(table1[x%100000%10000/1000],8,1);    
 246   4                 WriteChar(table1[(x%100000)/10000],7,1);    
 247   4                 WriteChar(table1[(x/100000)],6,1);
 248   4                 WriteString(s,0,0);
 249   4                 WriteChar(0x31,0,0);
 250   4                         WriteChar(0x53,1,0);
 251   4                 if(x>99999)
 252   4                         {
 253   5                          WriteString(s2,0,1);
 254   5                         }
 255   4               } 
 256   3        
 257   3              if(mark==3)
 258   3                       {
 259   4                         x=(T0count*65536+256*TH0+TL0)/10;
 260   4                 LcdPos(15,1);
 261   4                 WriteString(s1,0,1);
 262   4                 WriteChar(table1[(x%100000)%10000%1000%100%10],11,1);
 263   4                 WriteChar(table1[(x%100000)%10000%1000%100/10],10,1);    
 264   4                 WriteChar(table1[(x%100000)%10000%1000/100],9,1);    
 265   4                 WriteChar(table1[x%100000%10000/1000],8,1);    
 266   4                 WriteChar(table1[(x%100000)/10000],7,1);    
 267   4                 WriteChar(table1[(x/100000)],6,1);
 268   4                 WriteString(s,0,0); 
 269   4                 WriteChar(0x31,0,0);
 270   4                         WriteChar(0x30,1,0);
 271   4                         WriteChar(0x53,2,0);
 272   4                         if(x>99999)
 273   4                         {
 274   5                          WriteString(s2,0,1);
 275   5                         }
 276   4                 }
 277   3         
 278   3               
 279   3      
 280   3                         
 281   3      
 282   3      
 283   3      
 284   3      
 285   3      
 286   3          timecount=0; 
 287   3          T0count=0; 
 288   3          TH0=0; 
 289   3          TL0=0; 
 290   3          TR0=1;         //TR0=1,控制开关闭合,计数脉冲进入T1计数器,启动计数 
 291   3          } 
 292   2      } 
 293   1      } 
 294          //;=====================================================================
 295          
 296          
 297          
 298          void t0(void) interrupt 1 using 0      //T0中断服务 
 299          { 
 300   1          T0count++;                      //对P3。4口的脉冲进行计数 
 301   1      } 
 302          //;=====================================================================
 303          
C51 COMPILER V7.50   PINLVJI2                                                              10/26/2008 13:12:27 PAGE 6   

 304          
 305          
 306          void t1(void) interrupt 3 using 0       //T1中断服务 
 307          { 
 308   1          TH1=(65536-50000)/256;               //计数初值重装载 
 309   1          TL1=(65536-50000)%256; 
 310   1          timecount++; 
 311   1          if(mark==1)
 312   1               {  
 313   2             if(timecount==2)
 314   2              {   
 315   3               TR0=0;
 316   3              timecount=0;
 317   3              flag=1;                              // 置标志
 318   3              }    
 319   2               }
 320   1              if(mark==2)
 321   1               {
 322   2                if(timecount==20)
 323   2              {   
 324   3                  TR0=0;
 325   3              timecount=0;
 326   3              flag=1;                              // 置标志
 327   3              }    
 328   2               } 
 329   1             if(mark==3)
 330   1               {    
 331   2      
 332   2                if(timecount==200)
 333   2              {   
 334   3                  TR0=0;
 335   3              timecount=0;
 336   3              flag=1;                              // 置标志
 337   3              }    
 338   2               }
 339   1          }        
 340             


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2129    ----
   CONSTANT SIZE    =     57    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     19       9
   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 + -