![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hello,
I've been working for quite some time on a project following my recent obsession with radio-controlled airplanes. I've been wanting to create an IR transmitter / receiver set for micro planes (indoor, tiny ones)-- more as a learning process. However, after many tries I just cannot seem to get it right. I've tried quite a few things, at first I was using mikroBasic to encode and decode the pulse train which looks something like: ![]() But of course I only need three channels. The biggest problem I was having was timing-- the compiled code was just too inefficient. The transmitter was okay, but the receiver just wouldn't work. The way I was trying to decode the pulse: I figured I'd wait for the sync pulse, while in the background using the CCP module to capture the width of the pulses. I had TMR0 running and that was being used as a sort of counter for the PWM output (for the control surfaces). On TMR0 overflow => values (that were previously captured using CCP and stored in temp. buffers) were saved in their control-surface variable and the timer was reset. In the main routine I was using TMR0 as a counter-- kept comparing values of each control surface to the value of TMR0 and shut off any pin which had a value less than that of TMR0. This gave me a PWM output for each control surface (in theory). For example if the throttle value was 120. On TMR0 overflow the throttle pin would be set high. TMR0 would increment, 1, 2, 3, ... 119, 120 (and continue). But as soon as it reached 120, throttle pin would be set low. After much fiddling with mikroBasic code, I figured it all boiled down to assembly-level coding. The biggest problem for now with that is capturing the CCP values and scaling them to a 0-255 byte that I can compare. Anyways, after hovering around Nigel's website for a while I found that perhaps Manchester encoding might work (heck, there's much more code available for it!). So I'm just wondering, (sorry for the huge post), could I use Manchester coding to get a fairly okay IR TX / RX thing going or does anyone have any other recommendations (perhaps some idea on scaling the captured values from the CCP mode)? I'm rather stumped and confused! Thanks very much, -Omar P.S. Attached is some of the mikroBasic code, just to show you that I did put in some effort! |
|
|
|
|
|
|
(permalink) |
|
See the recent thread. One technic I used described there. I’m away of using CCP modules & it uses a software loops on a general I/O pin.
http://www.electro-tech-online.com/m...test-help.html |
|
|
|
|
|
|
(permalink) |
|
Thank you very much. After reading that post and looking at the code, I am really amazed at how simple efficient yet simple the code ended up being.
That's exactly what I was looking for! After going through the code, it seems the 38kHz carrier was done in software (which was neat) but I was going a different route-- simply ANDing a 38kHz pulse from a 555 timer with the PIC transmitter. I'm wondering, will this work as well? -Omar |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| FM Transmitter & Receiver | Suds | Electronic Projects Design/Ideas/Reviews | 11 | 22nd May 2007 02:15 PM |
| AM Transmitter and Receiver Help | arustu | Electronic Projects Design/Ideas/Reviews | 7 | 18th November 2006 07:09 PM |
| Transmitter/receiver radio project | TR | Electronic Projects Design/Ideas/Reviews | 1 | 7th May 2005 07:31 AM |
| fm transmitter and receiver | pepperman | Electronic Projects Design/Ideas/Reviews | 2 | 18th May 2004 07:36 PM |
| Guitar pack transmitter / Receiver Project | badflyer | Electronic Projects Design/Ideas/Reviews | 4 | 6th January 2004 12:01 AM |