How to send serial data after collecting data from different functions

Hi,

I need some help regarding my subject. My hardware is Arduino UNO. My setup is as follows.

I have 3 or 4 functions which collect GPS, compass and sensor data's. As telemetry i out put the data via xbee module wirlessly to my PC. My issue is when the data comes so fields missing due to delays on some operations. Example format of the data is lat,lon,heading,temperature,rpm. which is output from a serial.print

But when sometime due to some processes the some data misses. so tell me a way which i can do this much affectively.

I have seen some using struct to send bulk data with a CRC i guess. But i am not at all familliar about how to use struct data.

so hope to get some technical help from grat minds out there.. :)

Some ideas…

use a stop character to detect the end of a line. the stop character might be a new line or it might be some other type of ascii character. 

LIke you can send [data,data,data]  

then on your recieving end you check for “]”  if there was no “]”  then a full string didn’t come through… or alternatively only match between “[” and “]”  that way you always know its a complete message.

another way to do it is to only send a chunk at a time.  so you would send bursts like:

lat:123.45;

lon:123.45;

etc.  then you only have to deal with that particular variable at a time.  if there is a presence of a name and value then assign which ever item’s variable that value and if it doesn’t come through then it will just retain its old value until the next value is passed on the next loop.

There’s probably a lot of other things to look at.  I wonder why the data isn’t all coming through?  is it an interference with the RF transmission or is it that the arduino is not sending the data. what did you mean by “due to some processes the some data misses.”?


 

 

serial buffer…

Also, how long is the string you’re passing? Arduino serial only has a 64 byte buffer.  so if your information was longer than 64 bytes it would be cut off.

 

The data miss mean during

The data miss mean during the loop the field might be missed or sometime print on next set of data… it comes but miss orders or miss match the location of data arrangement. i will check the hint you gave and will see whats the output

its arround 36-40

its arround 36-40 charecters