gps芯片接收GPS数据分析

整体框架:

static void Gps_Task (void *p_arg)
{
(void)p_arg;

pub_memset_gps((u8*)&AGps,0,sizeof(RAM_AGPS));
while(1)
{
Gps_DataAnalyse();
Gps_AGpsHandle();
Gps_FaultCheck();
Gps_PowerManage();
OSTimeDly(T_45MS);
FeedDog();
}
}

现在解析Gps_DataAnalyse();

1.从GPS串口去数据,把数据存入TempFrameBuf。

  TempGLen = Bsp_UartRead_Gps(UART_INDEX_GPS, TempFrameBuf,GPS_FRAME_MAX_LEN);
if(TempGLen<=0) 
return GD_ERR;

2. GPS数据有7条,现在我分析其中一条数据¥GPRMC开头的

for(i=0;i<TempGLen;i++)
{
if(Gps_FrameOrg(TempFrameBuf[i],GpsFrameBuf,GPS_FRAME_MAX_LEN)==GD_OK)
{
if(
(pub_StrCompare(GpsFrameBuf,"$GPRMC")>=6)||
(pub_StrCompare(GpsFrameBuf,"$GNRMC")>=6)||
(pub_StrCompare(GpsFrameBuf,"$BDRMC")>=6)
) //看接收的数据开头是否为$GPRMC
{
if(Gps_RMC_Analyse(GpsFrameBuf,&Gps.Data.RMC,GPS_FRAME_MAX_LEN)==GD_OK)//把接收的数据放入内存里进行保存
FrameGrp |= 0x01;
}

}

//验证串口数据无误,更新内存里GPS数据,同时,在其他模块可以用到最新的GPS数据

if((FrameGrp&0x07)==0x07)
{
FrameGrp=0;
if(Gps_ExcursionFilter()==GD_OK)
{
Gps_DataUpdate(1);
}
else
{
Gps_DataUpdate(0);
}
SysRam.GpsPara.ReNew=1;
SysRam.GpsPara.TripSeconds++;
SysRam.GpsPara.TripTotalMiles += SysRam.GpsPara.SpdMsMean;
SysRam.GpsPara.TotalMiles       += SysRam.GpsPara.SpdMsMean;
SysRam.GpsPara.NoCgTotalMiles += SysRam.GpsPara.SpdMsMean; //参考调试变量

OdoData.TotalMiles_Gps     = SysRam.GpsPara.TotalMiles;
}
pub_memset_gps(GpsFrameBuf,0,GPS_FRAME_MAX_LEN);
}

}













没有更多推荐了,返回首页