Decoding data bitstream
2005-08-18 by Don Jackson
Here's a problem I have that maybe some of the gurus on this list can help with... I'm just starting on a project which requires decoding of a rather unusual AFSK bitstream and am seeking some ideas/opinions on the best way to do it with an AVR chip (most likely ATMega88 or 168). Each bit is equal length of 2100 microseconds (usec.) and consists of either 4 cycles each 525 usec. long (for a 1 bit) or 3 cycles each 700 usec. long (for a 0 bit). Frequencywise, this figures out to be approximately 1904.8 Hz and 1428.6 Hz. This is a synchronous format with no start/stop bits to the 8 bit bytes being sent. There are no provisions or restrictions on the number of same bits in a row which may be sent. Some (a fairly good number of them) sync bytes are sent initially. The total data string could be several hundred bytes long, so while the 2100 usec. bit length is pretty accurate, care must be taken to account for slight inaccuracy without depending on further sync pulses in the message. To further complicate matters, unfortunately noise free operation cannot be assumed as there may be some unexpected glitches come through. This is not a format I'd chose for transferring data, but I'm stuck with it. My initial thoughts are to try to time each pulse (cycle) to determine the bit ( 1 or 0 ) and to count the number of cycles so to figure out where one bit starts and ends. In case of noise impulses, the length of the pulse/cycle will be less than anticipated value and could probably be discounted as long as there was another timer going which would anticipate the end of the bit time. Not sure I'm making myself clear on this. I'm certainly open to other thoughts on the matter. Maybe this is not too unlike trying to decode barcode stuff (Dave VH?) and I should see what goes on there. Anyone? Regards, Don