标题: STM32F103ZET6的2通道ADC采样TFT屏显程序 [打印本页]

作者: 极光Tesla    时间: 2019-10-30 10:15
标题: STM32F103ZET6的2通道ADC采样TFT屏显程序
基于STM32F103ZET6芯片的2通道ADC采样TFT屏显程序,亲测可用

单片机源程序如下:
  1. #include "led.h"
  2. #include "delay.h"
  3. #include "key.h"
  4. #include "sys.h"
  5. #include "lcd.h"
  6. #include "usart.h"         
  7. #include "adc.h"

  8. extern vu16 ADC_DMA_IN[2]; //声明外部变量   

  9. int main(void)
  10. {         
  11.     u16 vol , cul;
  12.         float temp1,temp2;
  13.         delay_init();                     //延时函数初始化                                        
  14.         LCD_Init();                                
  15.         ADC_Configuration();                                  //ADC初始化

  16.         POINT_COLOR=RED;//设置字体为红色
  17.         LCD_ShowString(60,50,200,16,16,"HELLO WORLD");       
  18.         LCD_ShowString(60,70,200,16,16,"XXX Laboratory");       
  19.         LCD_ShowString(60,90,200,16,16,"Aurora--Tesla");
  20.         LCD_ShowString(60,110,200,16,16,"2019/10/30");       
  21.         //显示提示信息
  22.         POINT_COLOR=BLUE;//设置字体为蓝色
  23.         LCD_ShowString(60,130,200,16,16,"SRM VOLTAGE1:0.000A");
  24.         LCD_ShowString(60,150,200,16,16,"SRM VOLTAGE2:0.000A");             
  25.                        
  26.         while(1)
  27.         {
  28.                 vol=ADC_DMA_IN[0];       
  29.                 temp1=(float)vol*(3.3/4096);
  30.                 vol=temp1;
  31.                 LCD_ShowxNum(164,130,vol,1,16,0);//显示ADC的值
  32.                 temp1-=vol;
  33.                 temp1*=1000;
  34.                 LCD_ShowxNum(180,130,temp1,3,16,0x80);//显示ADC的值
  35.                
  36.         cul=ADC_DMA_IN[1];       
  37.                 temp2=(float)cul*(3.3/4096);
  38.                 cul=temp2;
  39.                 LCD_ShowxNum(164,150,cul,1,16,0);//显示ADC的值
  40.                 temp2-=cul;
  41.                 temp2*=1000;
  42.                 LCD_ShowxNum(180,150,temp2,3,16,0x80);//显示ADC的值
  43.                 delay_ms(250);
  44.         }
  45. }
复制代码

所有资料51hei提供下载:
2组ADC采样TFT显示.7z (229.42 KB, 下载次数: 71)


作者: 委曲求全    时间: 2019-12-21 16:01
这是采集的什么在lcd上显示




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