能不能帮我解释一下这个函数用ucgui
说明:在LCD上显示实时波形
------------------------------------------*/
void ShowRealTimeWave(void)
{
GUI_RECT Rect = {0,0,479,200}; //无闪烁显示区域
int i,j=0;
OS_CPU_SR cpu_sr = 0u;
WaveInfo.Vmax = 2047.0;
WaveInfo.Vmin = 2047.0;
for (i = 0; i < SAMPDEPTH; i++)
{ //把AD值按比例转换成在LCD上显示的值
ADCVlaue2ScreenValue = ( ADCConvertedValue*200/4096 );
if(WaveInfo.Vmax < ADCConvertedValue) //找出Vmax Vmin
{
WaveInfo.Vmax = ADCConvertedValue;
}
if(WaveInfo.Vmin > ADCConvertedValue)
{
WaveInfo.Vmin = ADCConvertedValue;
}
//周期追踪线寻找
if(ADCVlaue2ScreenValue>98 && ADCVlaue2ScreenValue<102 && j==0 && i>10 && i<200)
{
if(ADCVlaue2ScreenValue[i-5]>101 && ADCVlaue2ScreenValue[i+5]<99)
{
TrackLine_PriodStart = i;
j = 1;
}
}
else if(ADCVlaue2ScreenValue>98 && ADCVlaue2ScreenValue<102 && j==1 && i>TrackLine_PriodStart+20 && i<SAMPDEPTH)
{
if(ADCVlaue2ScreenValue[i-5]>101 && ADCVlaue2ScreenValue[i+5]<99)
{
TrackLine_PriodEnd = i;
j = 2;
}
}
}
TrackLine_VppMax = 200 - WaveInfo.Vmax*200/4096; //最大值追踪线
TrackLine_VppMin = 200 - WaveInfo.Vmin*200/4096; //最小值追踪线
if(JDQ_ACDC == 1) //AC耦合
{
WaveInfo.Vmax -= 2047.0;
WaveInfo.Vmin -= 2047.0;
}
WaveInfo.Vmax = (WaveInfo.Vmax/4095 * 3.3 * WaveCtrl.AmpDiv);
WaveInfo.Vmin = (WaveInfo.Vmin/4095 * 3.3 * WaveCtrl.AmpDiv);
WaveInfo.Vpp = WaveInfo.Vmax - WaveInfo.Vmin;
WaveInfo.Vrms = WaveInfo.Vpp*1000 / 2828;
OS_ENTER_CRITICAL();
GUI_MEMDEV_Draw(&Rect,&Draw,ADCVlaue2ScreenValue,0,0); //GUI无闪烁绘制波形
OS_EXIT_CRITICAL();
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>