借助2.2'TFT屏的显示能力,可以将A/D转换所获得的数据以波形的方式直观地展现出来,以内部温度传感器的采集为例,其绘制的温度曲线如下图所示,其温度波动值在1度左右。 芯片内部温度变化曲线图 实现该功能的关键程序如下: - POINT_COLOR=RED;
- BACK_COLOR=WHITE;
- i=0;
- LCD_ShowCharh(20,130,'t',0);
- LCD_ShowCharh(20,120,'=',0);
- LCD_ShowCharh(20,80,'C',0);
- while (1)
- {
- Delay_sec(1);
- t=(uint16_t)(( 1.26 -(double)ADCConvertedValue*ADC_VREF/4096)/(-0.00423) +25);
- LCD_ShowNum(20,100,t,2);
- sj=t*2;
- if(i==0) sp=sj;
- LCD_DrawLine(220-sp, 300-4*(i-1), 220-sj, 300-4*(i));
- sp=sj;
- if(i<72) i++;
- else
- {
- LCD_Clear(WHITE);
- LCD_DrawLine(10, 304, 220, 304);
- LCD_DrawLine(60, 10, 60, 304);
- LCD_DrawLine(100, 10, 100, 304);
- LCD_DrawLine(140, 10, 140, 304);
- LCD_DrawLine(180, 10, 180, 304);
- LCD_DrawLine(220, 10, 220, 304);
- LCD_ShowCharh(20,170,'A',0);
- LCD_ShowCharh(20,162,'/',0);
- LCD_ShowCharh(20,154,'D',0);
- LCD_ShowCharh(20,130,'t',0);
- LCD_ShowCharh(20,120,'=',0);
- LCD_ShowCharh(20,80,'C',0);
- i=0;
- }
- Delay_ms(200);
- }
复制代码
若将采集程序切换到其它通道,则可以观察到相应模拟信号量的变化。此外,还可以对多个通道的信号进行同步的观察。
|