Bi Phase vs Manchester code.
The reason for encoding your data is to eliminate long runs of ones or zeros which will cause the data slicer at the receiver to drift off and to provide sufficient data transitions to allow clock recovery. Common wisdom is to use Manchester code on RF links but there is an alternative that can be much better in many cases.
Manchester encodes a 1 with a dibit of 01. It encodes a zero with the opposite dibit 10.
What might have been, before encoding, 11010100 becomes 0101100110011010.
Now think about what happens if the receiver loses or gains a single bit due to noise which is pretty common in RF systems. The receiver will now be out of sync and all ones turn into zeros, all zeros become ones and the data is totally scrambled. The receiver will stay out of sync indefinitely and some external synchronisation scheme is needed to recover. This is typically the transmitter shutting off and carrier detect going low but on a noisy channel the Carrier Detect may never drop, or at least not start and stop cleanly.
An alternative is biphase which is the mainstay of the short haul cable modem business. Here a string of ones is shown by a polarity change at each bit boundary. Zeros are indicated by a change at the cell boundary PLUS a change in the cell centre. The great advantage of biphase is that a single bit error remains just a single bit error. Subsequent ones and zeroes will be correctly decoded. The disadvantage of biphase is frequency spread. Manchester with its 01 and 10 pairs has a spectrum very much centred at the data rate. The receive filters can be fairly tight.
Biphase on the other hand has two distinct tones at the data rate (zeros) and half the data rate for ones.
The software effort is very nearly the same for either system. The RF link can use the same strategy as for a short haul controlled carrier modem. Here the transmitter is off while Request To Send (RTS) is low. When the sending party wants to transmit, RTS is raised and the modem immediately starts sending a string of ones. The far end uses these ones to condition the data slicer and to synchronise clocks. After a brief delay, the sending modem grants Clear To Send (CTS) to the sending device and the data flow begins. The RTS/CTS delay can be set to suit the channel conditions. This becomes the preamble you need to send on the RF link anyway.
The receiver is forced back into sync every time a 1 bit is sent. For long runs of zeros the system can get half a bit out of sync but this throws up only one bit error not a continuous stream of errors as with Manchester.
The same message as above, before encoding, 11010100, becomes high, low, hilo, high, lohi, low, hilo, hilo. The periods of high, low, hilo and lohi are all identical.
At 4800 bps the modem sends a 2400 Hz MARK signal where each zero crossing spells a bit boundary from which clock and data can be extracted. For each SPACE the modem sends one full cycle of 4800 Hz and the zero crossing in the centre of the bit period is easily detected.
HTH
Brian