標(biāo)題: 分享一下STC12c5a60s2 adc測(cè)試程序 [打印本頁]

作者: FANGGE    時(shí)間: 2019-5-22 22:29
標(biāo)題: 分享一下STC12c5a60s2 adc測(cè)試程序
分享一下STC12c5a60s2   adc測(cè)試程序用的是p1.1通道,還可以改為其他通道

單片機(jī)源程序如下:
  1. #include "REG51.h"
  2. #include "oled.h"
  3. #include "bmp.h"
  4. #include "SHT20.H"

  5. #include "adc.h"

  6. int main(void)
  7. {            
  8.             u32 ch=0;
  9.             u8 t[]="hell world";
  10.                 OLED_Init();                        //初始化OLED  
  11.                 OLED_Clear();         //清屏
  12.             InitADC();
  13.                 while(1)
  14.                 {                 
  15.                         u8 num=GetADCResult();
  16.                        
  17.                        
  18.             OLED_ShowString(65,0,"ppm",16);
  19.                         OLED_ShowString(0,0,"co:",16);
  20.                         OLED_ShowNum(30,0,num,4,16);
  21.                         Delay1(20);
  22.                         if(num>80)
  23.                     {
  24.                         OLED_ShowNum(0,4,555,4,16);
  25.                        
  26.                         }
  27.                 }          
  28.        
  29. }
  30. //#include "stc12c5a56s2.h"
復(fù)制代碼

所有資料51hei提供下載:
STC12c5a60s2.zip (123.02 KB, 下載次數(shù): 104)



作者: venray    時(shí)間: 2021-3-24 14:52
非常實(shí)用,謝謝分享。我先看看




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