基于STM32F103ZET6芯片的2通道ADC采样TFT屏显程序,亲测可用
单片机源程序如下:
- #include "led.h"
- #include "delay.h"
- #include "key.h"
- #include "sys.h"
- #include "lcd.h"
- #include "usart.h"
- #include "adc.h"
-
- extern vu16 ADC_DMA_IN[2]; //声明外部变量
- int main(void)
- {
- u16 vol , cul;
- float temp1,temp2;
- delay_init(); //延时函数初始化
- LCD_Init();
- ADC_Configuration(); //ADC初始化
- POINT_COLOR=RED;//设置字体为红色
- LCD_ShowString(60,50,200,16,16,"HELLO WORLD");
- LCD_ShowString(60,70,200,16,16,"XXX Laboratory");
- LCD_ShowString(60,90,200,16,16,"Aurora--Tesla");
- LCD_ShowString(60,110,200,16,16,"2019/10/30");
- //显示提示信息
- POINT_COLOR=BLUE;//设置字体为蓝色
- LCD_ShowString(60,130,200,16,16,"SRM VOLTAGE1:0.000A");
- LCD_ShowString(60,150,200,16,16,"SRM VOLTAGE2:0.000A");
-
- while(1)
- {
- vol=ADC_DMA_IN[0];
- temp1=(float)vol*(3.3/4096);
- vol=temp1;
- LCD_ShowxNum(164,130,vol,1,16,0);//显示ADC的值
- temp1-=vol;
- temp1*=1000;
- LCD_ShowxNum(180,130,temp1,3,16,0x80);//显示ADC的值
-
- cul=ADC_DMA_IN[1];
- temp2=(float)cul*(3.3/4096);
- cul=temp2;
- LCD_ShowxNum(164,150,cul,1,16,0);//显示ADC的值
- temp2-=cul;
- temp2*=1000;
- LCD_ShowxNum(180,150,temp2,3,16,0x80);//显示ADC的值
- delay_ms(250);
- }
- }
复制代码
所有资料51hei提供下载:
2组ADC采样TFT显示.7z
(229.42 KB, 下载次数: 71)
|