Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

HOW TO filter GPRMC string using mikro c (proteus virtual terminal softsimulation)

Status
Not open for further replies.

arbabar

Member level 2
Joined
Aug 11, 2011
Messages
46
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,288
Location
Islamabad
Activity points
1,640
i m doing my GPS tracking Project.
and stuck in the $GPRMC string filtering as the GPS M-89 HOLUX (UART)serial transmit number of strings so our focus is on filtering gprmc string.
we are using pic 16f877A , so for testing i use two virtal terminal same 9600bps, attached the tx of first virtual terminal to rx of controller, and attached rx of second virtual terminal to tx of controller.
now i wrote the programme in mikro c and paste copy of GPS number of string in first virtual terminal but ist not working i show you my code. here i want to read the very first gprmc sting not the second or thirld one.

GPS STRING

$GPGGA,092750.000,5321.6802,N,00630.3372,W,1,8,1.03,61.7,M,55.2,M,,*76
$GPGSA,A,3,10,07,05,02,29,04,08,13,,,,,1.72,1.03,1.38*0A
$GPGSV,3,1,11,10,63,137,17,07,61,098,15,05,59,290,20,08,54,157,30*70
$GPGSV,3,2,11,02,39,223,19,13,28,070,17,26,23,252,,04,14,186,14*79
$GPGSV,3,3,11,29,09,301,24,16,09,020,,36,,,*76
$GPRMC,092750.000,A,5321.6802,N,00630.3372,W,0.02,31.66,280511,,,A*43
$GPGGA,092751.000,5321.6802,N,00630.3371,W,1,8,1.03,61.7,M,55.3,M,,*75
$GPGSA,A,3,10,07,05,02,29,04,08,13,,,,,1.72,1.03,1.38*0A
$GPGSV,3,1,11,10,63,137,17,07,61,098,15,05,59,290,20,08,54,157,30*70
$GPGSV,3,2,11,02,39,223,16,13,28,070,17,26,23,252,,04,14,186,15*77
$GPGSV,3,3,11,29,09,301,24,16,09,020,,36,,,*76


i wrote the code for it but it is not working.




the code that i wrote is


////////////////////////////////////////////////////code/////////////////////////////////////////////////////////////////////////////////


unsigned char Revd_char, GPS_array[80],x;

void main() {
UART1_init(9600); // set buard rate
GPS_array[80];

x=0;
while(x<60)
{ x=0;
Revd_char=0;
while(Revd_char!='$') //find the $ sign in the strings
{Revd_char=UART1_read();} //if not find the read char by char again
GPS_Array[x++]=Revd_char; //if found then store at 0 index of GPS_Array and x+1 its mean make x=1
Revd_char=UART1_read(); //then read again next char
if(Revd_char=='G') //if its match with G enter in loop
{ GPS_array[x++]=Revd_char;
Revd_char=UART1_read();} // same reading process and compare---
else {break;}
if(Revd_char=='P') // ---------------
{ GPS_array[x++]=Revd_char; // -----------------
Revd_char=UART1_read();} // ---------------
else {break;} // -----------------
if( Revd_char=='R') // ------------------
{ GPS_array[x++]=Revd_char; // ------------------
Revd_char=UART1_read();} // --------------
else {break;}
if(Revd_char=='M') /// -----------------
{ GPS_array[x++]=Revd_char;
Revd_char=UART1_read();} //--/-------------------
else {break;} // -------------------
if(Revd_char=='C')
{ GPS_array[x++]=Revd_char; //-----------------
Revd_char=UART1_read();} //---------------
else {break;} } //------------------------
while(revd_char!='*') // the end of the string is * so ready the string and store in GPS_array until it find *
{revd_char=UART1_read();
GPS_Array[x++]=Revd_char;
}
x=0;
while(GPS_Array[x]!='*') ////write it to hyper terminal the stored array that is $GPRMC
{UART1_write(GPS_Array[x++]);

} }


but it is not working.
so any one help me.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top