Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone!

I'm working on a programme which uses the GPS data of my LG LN550 PNA.
I'm programming in VS2005 C++, and I've written my own serial handling functions, they work great,I've tested them.
But there's some problem. I can read about 1.7 kbytes of data from the serial port, looks like:







That's good. I'm happy. BUT! After a few seconds, I receive:


You see, the NMEA sentences are totally mixed. If I close, and then open the port, it works for a few more seconds, but then it fails again. Closing and then opening the port all the time is not so good for me, because I need the GPRMC data in every second.
Any ideas?
Could anyone help me out of this problem?
Thank you very much!

Richard MacCutchan 20-Jul-10 9:02am    
Closing and opening the port suggests it is resetting something in your code. Check your code a little more closely to see how you are dealing with the characters as they arrive.

1 solution

I've written my own serial handling functions, they work great,I've tested them.

Hmm, they don't seem to work that well :)

You need a listener thread filling some buffer with the incoming characters and signalling the main thread when a full sentence is ready.
The main thread should then read the sentence and restart or wake up the listener.

Share this answer
matu91 9-Aug-10 12:00pm    
Actually, I've tested them on PC. I write my programme both for PC and PNA, and when the PC version works, I write the PNA version, too.
Thanks for your answer, but it didn't help me. The results that I've copied here were made by my test programme, which writes the received characters immediately into a text file. So something else can be the problem. Maybe SirfStarIII internal buffer problem, or what? I have absolutely no idea what can be the problem. iGo works, my prog doesn't. :)
Alain Rist 10-Aug-10 2:09am    
Unfortunately the IO routines are handled differently by WinCE and Windows. Check your device SDK IO support (it's not a Windows Mobile device and should have a matching SDK).
On a WinMobile 5 smartphone, I got that working with a reader thread reading 1 char at time until '$' signalling then a listener thread which would store the sentence post a message to the app main window, reset the read buffer and restart the reader thread. Worked OK for hours or days.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900