02-08-2012 09:22 AM
I have a data stream consisting of 16-bit hex words at 21 words per message block. How can I keep this syncronized and in a continuous read mode without having a buffer overflow? This is a GPS related device and of course I after I can stream the data in, it will then need to be decoded into numerical values for display.
I can manipulate and capture digital image streams easily! Why is this data stream such a difficult concept?!?!
Suggestions? Hint of a starting point? Wish I could also post some of my code, but it is on a different isolated computer system with no means to copy code off that system nor put it on this system. (not by my choice)
Thanks for any suggestions,
Bill
02-08-2012 10:49 AM
Bill,
How are the 21 word message blocks identified? Is there a particular byte sequence at the beginning or end or both?
Typically devices which stream message blocks have identifiers. At the receiver you accumulate bytes in a buffer (shift register) until you can identify a complete message block. That is extracted from the stream and decoded. Repeat for the next block.
Depending on the data rate and the amount of processing needed to decode and analyze the data, you may need to put the receiver and byte buffer in one loop and the decoding and analysis in a second parallel loop.
Lynn
02-09-2012 01:57 PM
Lynn,
First header has the hex word CAFB meaning it is data received from device, 2nd header is an identifier, such as 0x0020 which is a response code associating data sent due to a command sent to device. Then it obviouslyrepeats, upon startup it is doing a diagnostic BIT transmission of status data, then after sending the first command it switches to GPS data and other associated packets of data.
Currently I have it reading data in a while loop using a shift register and am successfully seperating out the 21 words, but it runs once then hangs. I know it is probably a simple fix and I still need to work out the details of decoding the values. Also, I failed to mention that my reader says there's 4096 bytes to read. I am thinking either my loop concept is defective or I have a buffer overflow issue.
In parralell I am working on writing the code to send commands to the device and so far the checksum method the manufacturer used I have not been able to duplicate. But this is another seperate issue.
Bill
02-09-2012 03:04 PM
WIthout seeing your code I have no other ideas. If you post your code someone may be able to help.
Lynn
02-10-2012 05:37 AM
I am working the issue of bewing able to post the code.
Bill