On Fri, 6 Mar 1998 14:52:00 PST "STRONG, Neil -Syntegra" writes: >I've written PIC code to decode a serial 12 bit word received via a >radio >module. > >My problem is noise - I'm decoding the signal by looking for a start >bit >of 2ms high, then sampling in the middle of the data bit, then >re-synchronising on the start of the next data bit by waiting for the >signal to go high This is not an optimum way to do it. The best receiver "knows" everything about the transmitted signal beforehand other than the *content of the message* (the only intentionally random parameter). Rather than constantly "guessing" and resynchronizing, etc. it should rely on the transmitter sending a consistently-timed message and examine the received signal primarlily to determine the data in the message. How do you approach this ideal? First, send a known sequence before (and possibly after) the variable data. The receiver analyzes this sequence to determine (a) if the signal is coming from a legitimate transmitter, or if it is just noise and (b) the exact timing of the unknown bits to follow. If most or all of the premble bits are as expected, the reciever goes on to collect the unknown bits. Obviously a "start bit" is a known sequence, but better performance can be realized by using more than one bit. During the preamble sequence, the receiver adjusts its bit timing to best match the incoming data. Once synchronization is established, the receiver just clocks in the unknown bits and makes only minor, if any, timing adjustments. This is how RS-232 over a wire works (with a single start bit, it starts timing at the leading edge of the bit, and rejects the sequence if the bit is not still 0 at the center). For radio, a more thorough method should be used. Additionally, the message can be made better-"known" to the receiver by including redundancy. If the same message data is always sent 3 times in a row for example, the receiver can reject messages that don't have the same data in all 3 fields or use a majority (2 out of 3) vote to decide which one is more likely correct. More advanced error-control codes should be considered if the time required by a simple redundancy scheme is too much. Of course, none of this works if the coding used to send the message is not compatible with the radio hardware. The simple radio modules using a regenerative receiver by necessity must AC-couple the data. This means that there is both a minimum pulse length that can be detected (set by the bandwidth), and a maximum that can be transmitted without distortion. Codes which guarantee a minimum number of data transistions (such as Manchester or the pulse-position modulation used by IR remotes) should be used. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]