標(biāo)題: 51單片機(jī)測(cè)頻計(jì)源程序 和資料 給大家分享一下 [打印本頁]

作者: 1443509763    時(shí)間: 2017-3-4 14:28
標(biāo)題: 51單片機(jī)測(cè)頻計(jì)源程序 和資料 給大家分享一下
51單片機(jī)的測(cè)頻源程序

完整源碼下載:
新測(cè)頻.rar (34.26 KB, 下載次數(shù): 29)



主程序分享:
  1. #include <reg52.h>
  2. #include "MircoDefine.h"
  3. #include "Timer.h"
  4. #include "SegDisplay.h"

  5. void main(void)
  6. {         
  7.          long int Freq=0;                         //頻率值清零
  8.           Timer_Init();                                //定時(shí)器初始化
  9.         while(1)
  10.         {                                                 
  11.            if(FlagSystem1Ms==1)
  12.            {       
  13.                  FlagSystem1Ms=0;          
  14.                  Seg7Display();         
  15.                 if(System1s==1)
  16.                 {
  17.                         System1s=0;
  18.                         Freq=65536*Overflow_Cnt+TH1*256+TL1; //           頻率值計(jì)算結(jié)果       
  19.                         TH1=TL1=0;                  //定時(shí)器1 計(jì)數(shù)清零
  20.                         Overflow_Cnt=0;          //溢出計(jì)數(shù)器清零
  21.                         TimeDisp(Freq);   //顯示值       
  22.                
  23.                 }       
  24.            }
  25.         }
  26. }
復(fù)制代碼







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1