Ruth Hendrix

Manchester Encoder/Decoder in assembly

Discussion created by Ruth Hendrix Employee on Jan 24, 2006
Latest reply on Jan 30, 2006 by Ruth Hendrix
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
Posted: Wed Jul 27, 2005 5:53 pm 
 
Hi,

We are looking for a design reference written is assembly. Have looked at AN2707SW but the code is poorly commented. Also have looked at the Romeo Tango designs but they are written in C. We just want to send 5 to 10 bytes over an RF link using OOK. Any help would be appreciated.

Posted: Thu Jul 28, 2005 8:32 am    


since the Manchester code is not that difficult to programm, i see the problem more in choosing the right device. You can use the output compare function of a timer subsystem for sending and the input compare function for receiving. So the whole stuff is rather easy to handle. What i need is more infos about you needs (RAM, ROM, speed, I/Os, etc.) and then we can look ahead!

Suluti

Posted: Thu Jul 28, 2005 7:18 pm    

Hi,

First I want to thank you for the response. We are using a MC9S08RC8CFJ. This is for a wireless application. Our symbol rate is 1000 bits per second. We are using on/off keying. The receive signal is active low when the transmitter carrier is on. Can use a keyboard or IRQ interupt pin. This part has 8k of ROM and 1K of RAM. Have not written code before using the timer input and output capture. Any help is greatly appreciated.

Regards,

Posted: Sun Jul 31, 2005 12:09 pm    

Next questions are:
Are you using the datalink in full- or halfduplex mode? (with other words: do you need to send and to receive at the same time, or do you listen and then send or send and then listen?) In the second case we could use only one I/O pin (PTB7/TPM1CH1 or PTD6/TPM1CH0).
How is your protocol ? (I.e. you use some kind of known protocol like MODBUS/ASCII)
Do you use a kind od OS? (like EBS08)

Saluti

P.S. i am triing to write some code as an example!

Posted: Sun Jul 31, 2005 2:26 pm    

Hi,

We will be using this half duplex. When an event occurs we send 5 bytes. We just transmit and do not listen since this is for a short range application. The receiver is less than 5 feet away. We are free to use any pin. No operating system or protocol is being used.

Regards,

Posted: Tue Aug 02, 2005 9:58 am  

Yesterday a have changed the code for my EBS08 for the RC-family so i can write and test (simulator only) the routins for bit/byte banging the "Mancherster code". The system you need seems very simple and thats why i have got the idea to make the transmitting stuff with my EBS08. It will have a 0.5ms TIC time so we can, without a lot of interrups, realize the code sending. You will simply have to put the length in a variable , the bytes to send in a buffer. Setting a bit (flag) does the complet sending of all the bytes. OK?

Saluti

Posted: Fri Aug 05, 2005 4:07 am    

Hi,

Our application is quite simple. What you are proposing will work just fine.

Best regards

Posted: Wed Aug 10, 2005 9:41 am    

There it is! Sorry, it tooks a little longer because i was busy! You can now download the code. You find it in the cookbook under HCS08 -> contributions -> OS.
It is called EBS08-RC8 example for Manchester code. I have tested it with the SW simulator only, but it seems to work. If there are any questions please let me know (probably also if it is working)

Saluti

Posted: Wed Aug 10, 2005 6:20 pm    

Hi,

The transmitter code looks very good, nice work. Will be back in the office next week and I will test it then. I need to let you know that in the receiver there may be narrow transitions (spikes) when the bit cell is high or low. This is caused by noise in the receiver during a weak signal condition. The receiver code must sample the bit cell (maybe 4-8 times) and make a detemination that it is valid data based on the number of samples that are high.

Again, thanks for the help and the great work.

Regards,

Posted: Tue Aug 16, 2005 7:35 am    

I have begun to design the code for the encoder (receiver). After two rather sleepless nights (because i was thinking about a fast AND simple solution) i got a idea. To solve the problem with glitches i will poll the input signal three times per T/2 (6 times per bit), so i can decide if the cell is LO or HI. Unfortunatly the simulator does not work with the output compare function. So i have lost some time with testing (i used the code on a GB60 and it works there). In the next days you will heare more of it.

Saluti

P.S. if somebody knows why the timer in the simulator does not work -> pleas let me know!

Posted: Tue Aug 16, 2005 1:47 pm    

Hi

Good to hear from you. It may be necessary to sample at least four times on each side of the bit cell. Noise from a weak signal in the receiver can cause 2 or more glitches in the high data bit so 3 samples may not be enough.

Regards,

Posted: Tue Aug 16, 2005 6:13 pm    

No problem! I am writing the code "flexible" (like i does it usualy) so you can choose the number of samples.

Saluti 

P.S. since the transmitter works acitve LO; how is the signal level on the receiver if the transmitter is active?

Posted: Tue Aug 16, 2005 6:24 pm    

Hi,

When the transmitter carrier is on the output of the receiver is low. No TX carrier the the RX is high.

Thanks,



Outcomes