标题: STC12C5单片机片内AD及1602显示 [打印本页]

作者: greagaer    时间: 2018-5-24 12:46
标题: STC12C5单片机片内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. //*****************************显示函数
  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. //*******************************主函数
  26. void main()
  27. {
  28.     InitLCM();  //液晶初始化
  29.     Init_ADC();  //AD转换初始化
  30.           
  31.           
  32.     while (1)
  33.     {
  34.     show();
  35.     }
  36. }
复制代码
其余代码已打包

2.zip

3.12 KB, 下载次数: 15, 下载积分: 黑币 -5






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1