NRZ

NRZ is one of the most basic of coding schemes. In this method the message signal does Not
Return to Zero after each bit frame. This means that the message exactly follows the digital
data structure. For example, a long data string of “1”s will produce a long high period in the
message signal. Transitions only occur in the message when there is a logical bit change.

This is a very easy method to implement on the encoding side but requires the data rate to be
known exactly on the receiving side in order to be decoded. Any mismatch in data clock tim-
ings will result in erroneous data that is only detectable with some error detection such as a
checksum or CRC. Also errors from the communication channel or interference will not be
detected without some form of data integrity checks.

BiPhase

BiPhase adds a level of complexity to the coding process but in return includes a way to trans-
fer the bit frame data clock that can be used in the decoding to increase accuracy. 1means state changing, 0 means state not changing. BiPhase coding says that there will be a state transition in the message signal at the end of every bit frame. In addition, a logical “1” will have an additional transition at the mid-bit . This allows the demodulation system to recover the data rate and also synchro-nize to the bit edge periods. With this clock information, the data stream can be recreated. This is similar to the method we will describe next.

Manchester

Manchester coding is one of the most common data coding methods used today. Similar to
BiPhase, Manchester coding provides a means of adding the data rate clock to the message
to be used on the receiving end. Also Manchester provides the added benefit of always yield-
ing an average DC level of 50%. This has positive implications in the demodulator’s circuit
design as well as managing transmitted RF spectrum after modulation. This means that in
modulation types where the power output is a function of the message such as AM, the aver-
age power is constant and independent of the data stream being encoded. Manchester coding
states that there will always be a transition of the message signal at the mid-point of the data
bit frame. What occurs at the bit edges depends on the state of the previous bit frame and
does not always produce a transition. A logical “1” is defined as a mid-point transition from low
to high and a “0” is a mid-point transition from high to low.Manchester Coding Basics

Manchester Encoding(Manchester as per 802.3).
  1. The first step is to establish the data rate that is going to be used.
  2. Once this is fixed, then the mid-bit time can be determined as ½ of the data rate period.
    • In our example we are going to use a data rate of 4kHz. This provides a bit period of 1/f=1/4000=0.00025s or 250µs. Dividing by two gives us the mid-bit time (which we will label “T”) of 125µs. Now let’s look at how we use this to encode a data
      byte of 0xC5 (11000101b). The easiest method to do this is to use a timer set to expire or interrupt at the T interval. We also need to set up a method to track which ½ bit period we are currently sending. Once we do this, we can easily encode the data and output the message signal.
    • The main procedure: 
    • 1.Begin with the output signal high.
      2.Check if all bits have been sent, If yes, then go to step 7
      3.Check the next logical bit to be coded
      4.If the bit equals “1”, then call Manchester One(T)
      5.Else(bit equals”0″) call Manchester Zero(T)
      6.Return to step 2
      7.Set output signal high and return

      •  Manchester One(T)
        1.Set the output signal low
        2.Wait for mid-bit time (T)
        3.Set the output signal high
        4.Wait for mid-bit time (T)
        5.Return to main procedure 1.
      • Manchester Zero(T)
        1.Set the output signal high
        2.Wait for mid-bit time (T)
        3.Set the output signal low
        4.Wait for mid-bit time (T)
        5.Return to main procedure 1.
    • These easy routines will provide an output at the micro controller pin that exactly encodes the data into a Manchester message signal at the desired data rate. The accuracy of the data rate and duty cycle depends on the accuracy of the clock source and the method used to create the wait times. It is recommended to use a timer/counter(clock), and associated interrupts(to cut every bits combination, for words, we use 8 bits).
    • According to G.E. Thomas’ convention,A 0 is expressed by a low-to-high transition, a 1 by high-to-low transition, the reverse of Manchester 802.3.Manchester example
    • We can see that if the Clock and data in the same phase, we get 0 in the Manchester code, if clock and data in the different phase, we get 1 in the manchester code. To make the encoding easier. We can use the truth table like:
    • original data  =  clock   XOR   Manchester value
           0              0                 0
           0              1                 1
           1              0                 1
           1              1                 0