標(biāo)題: STC12C5單片機(jī)片內(nèi)AD及1602顯示 [打印本頁]

作者: greagaer    時間: 2018-5-24 12:46
標(biāo)題: STC12C5單片機(jī)片內(nèi)AD及1602顯示
main.c
  1. #include <reg52.h>
  2. #include "intrins.h"
  3. #include "ADC.h"
  4. #include "1602.h"
  5. #define uchar unsigned char
  6. #define uint unsigned int
  7. extern float temp;

  8. uchar ge,shifen;
  9. //*****************************顯示函數(shù)
  10. void show()
  11. {
  12.         DisplayListChar(1,0,"CH0:");
  13. DisplayOneChar(7,0,(int)Count(0)+0x30);     //個位
  14. DisplayOneChar(8,0,'.');
  15. DisplayOneChar(9,0,(int)(Count(0)*100)%100/10+0x30); //十分位
  16. DisplayOneChar(10,0,(int)(Count(0)*100)%100%10+0x30); //百分位
  17. DisplayOneChar(11,0,'V');
  18.         DisplayListChar(1,1,"CH1:");
  19. DisplayOneChar(7,1,(int)Count(1)+0x30);     //個位
  20. DisplayOneChar(8,1,'.');
  21. DisplayOneChar(9,1,(int)(Count(1)*100)%100/10+0x30); //十分位
  22. DisplayOneChar(10,1,(int)(Count(1)*100)%100%10+0x30); //百分位
  23. DisplayOneChar(11,1,'V');
  24. }
  25. //*******************************主函數(shù)
  26. void main()
  27. {
  28.     InitLCM();  //液晶初始化
  29.     Init_ADC();  //AD轉(zhuǎn)換初始化
  30.           
  31.           
  32.     while (1)
  33.     {
  34.     show();
  35.     }
  36. }
復(fù)制代碼
其余代碼已打包

2.zip

3.12 KB, 下載次數(shù): 15, 下載積分: 黑幣 -5






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