Machester Encoding
Machester Encoding
Theory:
Manchester encoding is a synchronous clock encoding technique used by the physical layer of the Open System
Interconnection [OSI] to encode the clock and data of a synchronous bit stream. The idea of RZ and the idea
of-L are combined in manchester. Different encoding techniques are used in data communication to ensure
data security and transmission speed. Manchester encoding is an example of digital encoding. Because each
data bit length is defined by default, it differs from other digital encoding schemes. The bit state is defined by
the direction of the transition. Bit status is represented in various ways by different systems, although most
systems use 1 bit for low to high transitions and 0 bit for high to low transitions.
Program
#include "Manchester.h"
#include <stdexcept>
#include <sstream>
#include <cstring>
#include <cstdlib>
#ifdef DEBUG
#include <iostream>
#endif
int bid = i * 2;
int nbid = bid + 1;
int bit = 0;
int nbit = 0;
switch (real)
case 0:
break;
case 1:
break;
#ifdef DEBUG
std::cout << "[encode] " << real << " [" << bit << nbit << "]" << std::endl;
#endif
output[bid] = bit;
output[nbid] = nbit;
}
return output;
if ((length % 2) != 0)
int bid = i * 2;
std::stringstream con;
int real = 0;
if (strcmp(sbit, MANCHESTER_ONE) == 0)
real = 1;
real = 0;
#ifdef DEBUG
std::cout << "[decode] bit: " << bit << nbit << " [" << real << "]" << std::endl;
#endif
output[i] = real;
return output;