Decod Msg GPS

Dependencies:   C12832 mbed

Fork of ComGPS by SAADI Nadia

Committer:
pfe
Date:
Tue Mar 03 13:35:34 2015 +0000
Revision:
1:821bd360ec5b
Decod Msg GPS

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pfe 1:821bd360ec5b 1 unsigned short *P0_Msg,*P_Msg;
pfe 1:821bd360ec5b 2 unsigned short MSG_GPGGA_Valid;
pfe 1:821bd360ec5b 3 unsigned short MSG_GPRMC_Valid;
pfe 1:821bd360ec5b 4 unsigned short DL,Npt,Pospt;
pfe 1:821bd360ec5b 5 unsigned short Start,End;
pfe 1:821bd360ec5b 6
pfe 1:821bd360ec5b 7 unsigned short hh,mm,ss;
pfe 1:821bd360ec5b 8 unsigned short LatDeg,LatMin,LatMin1,LatMin2,LatDir;
pfe 1:821bd360ec5b 9 unsigned short LongDeg,LongMin,LongMin1,LongMin2,LongDir;
pfe 1:821bd360ec5b 10 unsigned short Qual;
pfe 1:821bd360ec5b 11 unsigned short SignHMSL,HMSL_L,HMSL_H,HMSL_1,HMSL_2,HUnite;
pfe 1:821bd360ec5b 12 unsigned short dd,yy,mn,val;
pfe 1:821bd360ec5b 13
pfe 1:821bd360ec5b 14 unsigned short Data[16],PosV[16];
pfe 1:821bd360ec5b 15 //------------------------------------------------------------------------------
pfe 1:821bd360ec5b 16 //Calcul de la longueur des sous message
pfe 1:821bd360ec5b 17 unsigned short Get_Length(unsigned short index)
pfe 1:821bd360ec5b 18 {
pfe 1:821bd360ec5b 19 unsigned short LongData;
pfe 1:821bd360ec5b 20 LongData=PosV[index+1]-PosV[index]-1;
pfe 1:821bd360ec5b 21 return LongData;
pfe 1:821bd360ec5b 22 }
pfe 1:821bd360ec5b 23 //Décomposition du message en Sub message
pfe 1:821bd360ec5b 24 void Set_Data(unsigned short index)
pfe 1:821bd360ec5b 25 {
pfe 1:821bd360ec5b 26 unsigned short ii,jj;
pfe 1:821bd360ec5b 27 ii=0;
pfe 1:821bd360ec5b 28 Start = PosV[index]+1;
pfe 1:821bd360ec5b 29 index++;
pfe 1:821bd360ec5b 30 End = PosV[index];
pfe 1:821bd360ec5b 31 P_Msg = P0_Msg+Start;
pfe 1:821bd360ec5b 32 for(jj=Start;jj<End;jj++)
pfe 1:821bd360ec5b 33 {
pfe 1:821bd360ec5b 34 Data[ii]=*P_Msg;
pfe 1:821bd360ec5b 35 P_Msg++;
pfe 1:821bd360ec5b 36 ii++;
pfe 1:821bd360ec5b 37 }
pfe 1:821bd360ec5b 38 }
pfe 1:821bd360ec5b 39 //Vérification des sub message
pfe 1:821bd360ec5b 40 void Validation_StrToFloat(unsigned short LongData)
pfe 1:821bd360ec5b 41 {
pfe 1:821bd360ec5b 42 unsigned short ii;
pfe 1:821bd360ec5b 43 Npt=0;
pfe 1:821bd360ec5b 44 Pospt=0;
pfe 1:821bd360ec5b 45 for(ii=0;ii<LongData;ii++)
pfe 1:821bd360ec5b 46 {
pfe 1:821bd360ec5b 47 if(Data[ii]=='.')
pfe 1:821bd360ec5b 48 {
pfe 1:821bd360ec5b 49 Npt++;
pfe 1:821bd360ec5b 50 Pospt=ii;
pfe 1:821bd360ec5b 51 }
pfe 1:821bd360ec5b 52 else if((Data[ii]<48)||(Data[ii]>57)) Npt=Npt+2;
pfe 1:821bd360ec5b 53 }
pfe 1:821bd360ec5b 54 }
pfe 1:821bd360ec5b 55 //------------------------------------------------------------------------------
pfe 1:821bd360ec5b 56 #include "DecMsgGPGGA.h" // GPGGA
pfe 1:821bd360ec5b 57 //------------------------------------------------------------------------------