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.

How to generate two frequencies from a PIC

Status
Not open for further replies.

slaamdunk@gmail.com

Junior Member level 1
Junior Member level 1
Joined
Aug 27, 2013
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
130
Hi,

I am trying to build an IR transmitter and I am needed to differentiate two button pushes by sending two different frequencies to the IR transmitter and to the receiver.
How can it be done ? Can I use two timers, Timer1 and Timer2 at the same time to count till the required frequencies ?
Thank You
 

You can but it would be simpler to use one timer and change the value loaded into it according to which button was pressed. You should note that if you are using 'remote control' types of IR receivers, they are fairly sensitive to the carrier frequency you feed them and they may not work well if you shift far from their design frequency (usually 38KHz).

Brian.
 

That might work but I'm worried that if you are using standard receiver modules, you may get the same output signal from both frequencies. Standard receivers tell you if there is a signal at (or close to) 38KHz but their output is not the carrier itself, just an indication of whether it's there or not. If you change from 36KHz to 40 KHZ the chances are it will tell you both are present but not which one it is.

If you are using a standard receiver, a better method of sending data as a frequency shift is to keep a carrier signal at 38KHZ but turn it on and off at different speeds dependng on which button is pressed. For example, if you interrupt the 38KHz at 100Hz and 90Hz you will get a 100HZ or 90Hz output from the receiver. Interrupting the carrier is easy if you use a PIC with PWM capbility, just set the PWM to 38KHz and 50% duty cycle then enable or disable the PWM module at your chosen data rate.

Brian.
 

That might work but I'm worried that if you are using standard receiver modules, you may get the same output signal from both frequencies. Standard receivers tell you if there is a signal at (or close to) 38KHz but their output is not the carrier itself, just an indication of whether it's there or not. If you change from 36KHz to 40 KHZ the chances are it will tell you both are present but not which one it is.

If you are using a standard receiver, a better method of sending data as a frequency shift is to keep a carrier signal at 38KHZ but turn it on and off at different speeds dependng on which button is pressed. For example, if you interrupt the 38KHz at 100Hz and 90Hz you will get a 100HZ or 90Hz output from the receiver. Interrupting the carrier is easy if you use a PIC with PWM capbility, just set the PWM to 38KHz and 50% duty cycle then enable or disable the PWM module at your chosen data rate.

Brian.


Thanks a lot for your replies Brian, but I had some further questions
1) What do you mean by Standard Receiver modules ?
2) Does the second para infer that instead of interrupting at 36KHz and 40KHz respectively interrupt it at 100Hz ?
I am new to PIC programming and its different applications and is taking some extra time for me to understand.
Thanks for your patience Brian.
 

If you use a single IR LED and a single IR photodiode/phototransistor you can use any frequency you like as long as it's within the speed capability of the devices but I'm concerned that because you are using frequencies close to 38KHz you are using the kind of IR receiver module used in TVs and VCRs (often but incorrectly called TSOP modules). If this is what you are using, there is more than just a light detector inside the package, it also has a bandpass filter to reject frequencies away from 38KHz, an envelope detector and a monstable to clean up the output signal. Basically, the module manufacturer tries to make it user friendly to equipment manufacturers by putting some of the signal processing inside the receiver module.

If what you are trying to do is receive 40KHz and 36KHz at the output of one of these modules, it won't work. Although the frequencies may pass reasonably well through the 38KHz filter because they don't have very sharp responses, the envelope detector and monostable will only respond to the presence or absence of the signal, not the specific frequency. If you imagine an actual remote control sending data 1010 it would be sent as 38KHz ON, pause with nothing sent, 38KHz on again then another pause. I wrote an article about this some time ago and it's getting a bit dated now but may help to explain things: http://www.atv-projects.com/IR_Remote_Control.html

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top