CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PROBLEM IN EXTRACTING THE REQUIRED STRING FROM SERIAL DATA

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mugheesahmed



Joined: 12 Jun 2006
Posts: 9

View user's profile Send private message

PROBLEM IN EXTRACTING THE REQUIRED STRING FROM SERIAL DATA
PostPosted: Mon Nov 13, 2006 12:45 pm     Reply with quote

following is tha serial data(one packet) i am getting form a GPS at 4800 baud with small intervals.(each new line starts before the $ sign and there is a carriage return after each line)
--------------------
$GPRMC,181658,A,3404.221,N,07238.833,E,000.0,360.0,131106,002.3,E*71
$GPRMB,A,,,,,,,,,,,,V*71
$GPGGA,181658,3404.221,N,07238.833,E,1,00,2.0,367.2,M,-39.5,M,,*65
$GPGSA,A,3,,,,,,,,,,,,,6.5,2.0,3.0*30
$GPGSV,2,1,08,03,32,281,47,07,31,208,47,09,28,077,46,14,48,215,50*7F
$GPGSV,2,2(08,18,55,035,51,19,19,312,43,21,54,119,51,22,58,316,51*7F
$PGRME,15.0,M,22.5,M,15.0,M*1B
$GPGLL,3404.221,N,07238.833,E,181659,A*2C
$PGRMZ,1205,f,3*2D
$PGRMM,WGS 84*06
$GPBOD,,T,,M,,*47
$GPRTE,1,1,c,0*07
---------------------

what i want is to extract the very first i.e. $GPRMC string and then display it on the hyper terminal...
i have tried it using the following code simply but it duznt seem to work...
----------------
main()
{
while(true)
{
value=getc();
putc(value);

if (value==0x0d)//as each line ends with a CR so using this condition
break;
}
}
----------------
what i have observed is that if the condition never becomes true...the whole packet is shown correctly on the hyper terminal screen...however, if the condition is met...the result is just garbage...or first few bytes are not correct; the rest are fine but still that makes the whole string of $GPRMC useless.......however the program does manage to come out of the loop...

NEED YOUR GUYS HELP...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 13, 2006 1:16 pm     Reply with quote

Use the forum's search page to search for: GPRMC
http://www.ccsinfo.com/forum/search.php

Also search for NMEA or GPS.

There is a lot of sample code in the forum archives.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group