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

📄 freqen.lst

📁 基于高速51单片机的,带示波器功能的频率计原码,还能分析PWM红外编码.液晶显示.
💻 LST
📖 第 1 页 / 共 2 页
字号:
 182   1      //--------------------------------------------------------------------
 183   1              if(danwei=='K' && point==1)
 184   1              {       
 185   2                      temp=1000000/temp;
 186   2                      temp&=0x0000ffff;
 187   2                      temp_to_tempx(temp);
 188   2                      danwei_t='u';
 189   2              }
 190   1              if(danwei=='K' && point==2)
 191   1              {
 192   2                      temp=100000000/temp;
 193   2                      temp&=0x0000ffff;
 194   2                      temp_to_tempx(temp);
 195   2                      danwei_t='n';
 196   2              }
 197   1              if(danwei=='M' && point==0)
 198   1              {
 199   2                      temp=10000000/temp;
 200   2                      temp&=0x0000ffff;
 201   2                      temp_to_tempx(temp);
 202   2                      danwei_t='n';
 203   2              }
 204   1              if(danwei=='M' && point==1)
 205   1              {
 206   2                      temp=1000000/temp;
 207   2                      temp&=0x0000ffff;
 208   2                      temp_to_tempx(temp);
 209   2                      danwei_t='n';
 210   2              }
 211   1      
 212   1              dis_one_zi(2,0,x51,1,1);//周
 213   1              dis_one_zi(2,1,x52,1,1);//期
 214   1              dis_one_char(2,11,0x7f,0);
 215   1              dis_one_char(2,12,danwei_t,1);
 216   1              dis_one_char(2,13,'S',1);
 217   1              dis_one_char(2,14,0x7f,0);
 218   1              dis_one_char(2,15,0x7f,0);
 219   1              dis_one_char(2,4,0x7f,0);
 220   1                      if(temp==65535)
 221   1                      {
 222   2                              dis_one_char(2,6,'O',1);
 223   2                              dis_one_char(2,7,'V',1);
 224   2                              dis_one_char(2,8,'E',1);
 225   2                              dis_one_char(2,9,'R',1);
 226   2                              dis_one_char(2,10,'!',1);
 227   2                      }
 228   1                      else
 229   1                      {
 230   2                              dis_one_char(2,6,temp0+0x30,1);
 231   2                              if(temp0==0)
 232   2                              dis_one_char(2,6,0x7f,0);
 233   2                              
 234   2                              dis_one_char(2,7,temp1+0x30,1);
 235   2                              if(temp0==0 && temp1==0)
 236   2                              dis_one_char(2,7,0x7f,0);
 237   2                              
 238   2                              dis_one_char(2,8,temp2+0x30,1);
 239   2                              if(temp0==0 && temp1==0 && temp2==0)
 240   2                              dis_one_char(2,8,0x7f,0);
 241   2                              
C51 COMPILER V8.05a   FREQEN                                                               08/21/2007 12:58:01 PAGE 5   

 242   2                              dis_one_char(2,9,temp3+0x30,1);
 243   2                              if(temp0==0 && temp1==0 && temp2==0 && temp3==0)
 244   2                      dis_one_char(2,9 ,0x7f,0);
 245   2                              
 246   2                              dis_one_char(2,10,temp4+0x30,1);
 247   2                      }
 248   1      }
 249          //--------------------------------------------------------------------
 250          void delay_1(uchar time)
 251          {
 252   1              while(--time!=0)
 253   1              delay(50000);
 254   1      }
 255          //--------------------------------------------------------------------                  
 256          void freq()     //频率计子程序
 257          {
 258   1              unsigned long temp=0x30;
 259   1              uchar del=5;
 260   1              timer_init();
 261   1      reset: gate=4;
 262   1              sel_x(100);
 263   1              a1=1;
 264   1              a2='M';
 265   1              while(1)
 266   1              {
 267   2       //---------------------------------------------------
 268   2                              key1=1;
 269   2                              key0=1;
 270   2                              delay_1(5);
 271   2                              if(key0==0 || key1==0)
 272   2                              goto exit;
 273   2                              temp=temp_h*256+temp_l;
 274   2                              if(TF1)
 275   2                              {
 276   3                                      TF1=0;
 277   3                                      TH1=0;
 278   3                                      TL1=0;
 279   3                                      dis_cls();
 280   3                                      dis_one_zi(0,0,x43,1,1);
 281   3                                      dis_one_zi(0,1,x44,1,1);
 282   3                                      dis_one_zi(0,2,x45,1,1);
 283   3                                      dis_one_zi(0,3,x46,1,1);
 284   3                                      dis_one_zi(0,4,x47,1,1);
 285   3                                      dis_one_zi(0,5,x48,1,1);
 286   3                                      dis_one_zi(0,6,x49,1,1);
 287   3                                      dis_one_zi(0,7,x50,1,1);
 288   3                                      goto reset;
 289   3                                      }
 290   2                              temp=temp_h*256+temp_l;
 291   2                              if(sel_100==1 && temp<=5000 && gate==4)
 292   2                              {
 293   3                                      sel_x(10);
 294   3                                      a1=0;
 295   3                                      a2='M';
 296   3                                      delay_1(del);
 297   3                              }
 298   2                              temp=temp_h*256+temp_l;
 299   2                              if(sel_10==1 && temp<=5000 && gate==4)
 300   2                              {
 301   3                                      sel_x(1);
 302   3                                      a1=2;
 303   3                                      a2='K';
C51 COMPILER V8.05a   FREQEN                                                               08/21/2007 12:58:01 PAGE 6   

 304   3                                      delay_1(del);
 305   3                              }
 306   2                              temp=temp_h*256+temp_l;
 307   2                              if(sel_1==1 && temp<=5000 && gate==4)
 308   2                              {
 309   3                                      gate=40;
 310   3                                      a1=1;
 311   3                                      a2='K';
 312   3                                      delay_1(del);
 313   3                              }
 314   2                       //---------------------------------------------------
 315   2                              temp=temp_h*256+temp_l;
 316   2                              if(sel_1==1 && temp>50010 && gate==40)
 317   2                              {
 318   3                                      gate=4;
 319   3                                      a1=2;
 320   3                                      a2='K';
 321   3                                      delay_1(del);
 322   3                              }
 323   2              
 324   2                              temp=temp_h*256+temp_l;
 325   2                              if(sel_1==1 && temp>50010 && gate==4)
 326   2                              {
 327   3                                      sel_x(10);
 328   3                                      a1=0;
 329   3                                      a2='M';
 330   3                                      delay_1(del);
 331   3                              }
 332   2                              temp=temp_h*256+temp_l;
 333   2                              if(sel_10==1 && temp>50010 && gate==4)
 334   2                              {
 335   3                                      sel_x(100);
 336   3                                      a1=1;
 337   3                                      a2='M';
 338   3                                      delay_1(del);
 339   3                              }
 340   2                              if(temp>50000)
 341   2                              goto reset;
 342   2                      
 343   2                              dis_mod(temp,a1,a2);
 344   2               //---------------------------------------------------
 345   2                      }
 346   1      exit:   TMOD=0x00; //T1 做门控计数
 347   1                      ET0=0;
 348   1                      EA=0;
 349   1                      TR0=0;
 350   1                      TR1=0;
 351   1                      p3_5=0;
 352   1                      delay_1(10);
 353   1                      keyfuncindex=0;
 354   1                      d0();
 355   1      }
 356          //--------------------------------------------------------------------                  


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1718    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2      13
   IDATA SIZE       =   ----    ----
C51 COMPILER V8.05a   FREQEN                                                               08/21/2007 12:58:01 PAGE 7   

   BIT SIZE         =      5    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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