Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

manchester coding

Status
Not open for further replies.

darvaish

New Member
Can some body give me C code to Manchester encode and decode a byte of data .
I am using PIC18F452 mcu and C18 compiler.

I need a function like

Encode(byte in)
{
return (byte [2] manchester);
}

Decode(byte [2] manchester)
{
return(byte out);
}
 
i never used it but if i remember correctly manchester code is very much
like regular binary code except that:
- each "0" is presented by two bits "10" (transition from high to low) and
- each "1" is presented by two bits "01" (transition from low to high).

so binary sequence 01101001
would look like 1001011001101001
when encoded.

this method is supposed to ensure alternations in long sequences
of same bit such as 000000 or 1111111.
with manchester code it is impossible to have more than two "0"s or two "1"s
side by side. if such scenario is detected, signal is considered faulty and
ignored. also if you had IR LEDs transmit sequence like
111111... they wouldn't last long.
 
Here's sourcecode from the radiotronix website. It gives a CCS PIC C example for encoding / decoding using their transmitter recevier pair. You should be able to adapt it quite easily.

**broken link removed**
 
Status
Not open for further replies.

Latest threads

Back
Top