This technology shares a lot with decoding hand scanned barcodes. The symbology helps a lot, but the link will distort the data. If the soft= ware is smart enough to correct for that distortion, then you can do amazin= g things. Keys to good decoding: Assuming you have the tools to get at it at this level Trigger on changes in state, and measure the time between changes. Determine the transmit speed by taking the sum of a few known bits, and div= iding by the number of bit times this should be. =20 For example a preamble byte which should be 0x55 can be interpreted as 0101= 0101 or eight bit times. The bits might be 100uS wide nominal, but really = be something like 75, 105,110,70,120,60,115,80 Note: I just made up these bit timings, real data would be more "coherent",= in that the sum of the error in 1 bits and 0 bits would balance. So this sequence should have taken 800uS, and is actually 735 so we are slo= w or the transmitter is fast. No worries. Nominal bit time is 91.875 or simplify to 92 for integer math. Discard impulse noise in either direction by deleting two timing entries, a= nd giving that time back to the pulse it came from. (easier with pictures t= han text.) This is very similar to handling dirt and dropouts in barcodes. Impulse noise is defined by two transitions separated by less than half a b= it time. Handle mark/space distortion. In your preamble, even three bits as in UPC,= measure the mark and space periods, determine the delta, cut that in half,= and compensate each bit accordingly. In the preamble, the sum of the 1 bits is 315 and divide by four (# of bits= sampled) and we find the average 1 ("Module" in barcode terms) is 78.78 or= 79 for integer math. Handling the distortion, we find the bit errors as follows: -4,26,31,-9,41,-19,36,1 Obviously this is faked data because the positive= and negative distortions don't balance, but for sake of brevity, lets assu= me that we came up with this data instead: -4,4,-4,4,-4,4,-4,4 This would be data with only mark-space distortion, an= d it would say that zeroes are biased short. Sum the 1 bit errors, divide = by 4 (the number of 1 bits) and you get 16/4=3D4. Grow the 0 bits by 4 and shrink the 1 bits by 4, and you get errors of 0,0,= 0,0,0,0,0,0. Of course it never works out this cleanly in real life. Normally the mark space distortion is smaller than other problems, and we s= till have some error at this point. When looking at individual bits, don't just throw away information! If a = bit is 1.2 bit times wide, then correct it to 1.0 and give the 0.2 to it's = neighbor. Now you have cleaner data which can be compared to the module, and if a tim= ing is more than half a module wide, and less than 1.5 module wide, then it= 's really 1 module wide. So, find the error, and give that to the next bit in the chain, correcting = this bit to ideal. The output of this stage is timings that are nearly perfect, and can be eas= ily decoded. Walk through the timings, discarding bits or pairs of bits (depends on your= encoding scheme) till you start seeing valid data. This lets you drop noi= se that looked like valid bits. Other things may cause errors that reach 1.5 bit times. With USART encodin= g, you're done. It's not possible to recover if the error is more than 50%. But by taking out impulse noise and mark-space distortion, both of which ar= e always present, then you have pulled some amount of your data back from t= he abyss. Now at a higher level, you can do error correcting codes where you can reco= nstruct the message with some number of missing bytes, and from this layer = of decoding you can mark which bytes you know you couldn't read. This may seem a little pedantic, but the difference can be huge. I once re= -wrote some 433 receiver code that was having errors a few feet away, and e= nded up with perfect copy at 1000' with compromised antennas on both ends. This is a compressed explanation, which I typed up on the fly. I can provi= de AVR code which implements this, and is reasonably well commented. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .