Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

manchester decoding program using AT89C52

Status
Not open for further replies.

harii

Newbie level 1
Joined
Mar 3, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
kanchipuram
Activity points
1,288
Hi, I need help about programming of AT89C52 microcontroller. i want to transmit some encoded serial data via wireless medium by RF module (433Mhz). In the receiver part what should i do to get that real data? pls help me.......[/b]
 

Do not use the uart. You must bit-bang the data out of one of the port pins.
This is what I do.

Transmission looks like this:

1. Send 3 preamble bytes (055h,0AAh,0FFh) Using regular bit rate. In my case it is 300uS per bit.

2. Send two start bits. Each bit is double bit rate. In my case it is 600uS per bit. (low for 600uS, then high for 600uS)

3. Send the encoded address bits (I use 8 bit for address). This can be anything you want, as long as it is the same in the receiver.

4. Send the encoded command byte ( I send a byte, 8 bits)

For the encoding, every bit begins with a "0" and ends with a "1". This makes it easy to detect when every bit begins, and when every bit ends. It also works very reliably with the cheap RF modules.

To send a "0", transmit "011".
To send a "1", transmit "001".
the centre bit determines the bit that is being sent.

For the receiver,

Set up a timer required to measure bit rate. I won't go into this here.

Also set up an external interrupt that triggers on a low level. In the ISR, the start bit period is measured (both high & low bits are measured). If it is not 600uS, exit. If the start bits are valid, (both low & high times are at least 600uS each) then disable the external interrupt.

You are now synchronized. Read the state of the pin every 300uS. Exit back to main routine where the external interrupt is re-enabled, and wait for a low level flag.

What I do is set a flag in the low level ISR. The main routine just loops until the flag is set, then proceeds to measure the low time and the high time.

It is not very difficult to do if you take it a step at a time. The transmitter is easy to do, the receiver is where things get complicated.

Good Luck
 

Do not use the uart. You must bit-bang the data out of one of the port pins.
This is what I do.

i cant understand the reason... can you explain why?
 

Why? Because the cheap wireless modules need to see an equal amount of 1's and 0's in order to stay synchronized. Start/stop bits can interfere with the transmission.

I never had 100% reliability when using the low cost rf modules with the uart of my MCU. It worked, but not 100% of the time. The above method I described works 100% reliably.

I had a few keyfob's lying around that I wanted to use for a simple remote control. They used an encoder chip. I did not have the decoder chip to match so I did it with software.

A logic analyzer will save you a lot of trouble.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top