![]() |
digital output frequency
Hello everyone!
Is there any command in C language equivalent to freqout in Pbasic language, or a way to do a digital output oscillate in a 38500 frequency? Thanks in advance |
Re: digital output frequency
Oliver,
Take a look at Kevin's last year's beacon code (here), you can modify the EDU-RC code to do what you want. The code has lots of comments and should help you. Any questions, ask! ;) |
Re: digital output frequency
Quote:
|
Re: digital output frequency
You can use the CCP module on the PICs to get a signal on pwms 13-16 there is an example of that in the code I believe. If not its in one of the programming .pdf's somwhere. Not 100% sure all what you need to do, but check out some of the programming guides and datasheets on microchip.com about programming it too.
|
Re: digital output frequency
Quote:
Oliver, I was kind of in a hurry (watching two webcasts at the same time :D ), so here's a bit of clarification from my previous post: If you don't need to send those pulses at a precise rate, as the beacon code did last year, you can probably just use Kevin's LED Dimmer code to generate PWM signals. Using that file and the PIC18F8520 data sheet (pages 143-144 and 156-157) you can select the frequency you want. As a matter of fact, I believe the following code (copy'n'paste inside the User_Initialization function in your user_routines.c file) will generate you a nice 38.46 KHz PWM with a 50% duty cycle. I don't have an RC or EDU in front of me right now to test it; if your application involves human safety, wait till someone more knowledgeable (yes, Kevin Watson ;) ) approves this code, otherwise, just test it! :p (be aware that using IFI's PWM will 'cause you trouble if using interrupt intensive code, especially Kevin's gyro code - both use Timer2) Code:
PR2 = 0x40; // sets 38461 Hz freq.[EDIT] Why not just use last year's IR receivers (am I wrong assuming you want that particular 38500 Hz frequency for that? :)), rated at 40 KHz, and use the code that's already available from a much much more reliable source? :] |
Re: digital output frequency
Quote:
-Mike EDIT: ok, i didn't read ahead, it was already said, but the boe bots were a neat little device. |
Re: digital output frequency
Thanks Manoel and Jonathan, I looked the codes with attention and I belive that using signal on pwms 13-16 it will works. Only a question, What does CCP mean?
Yes Manoel, you are right, I want do the same that we do with BOEBots, use IR sensor to detect objects. Don't worry my applications don't involves human safety. :D I will try to do it monday and later I tell the results! |
Re: digital output frequency
Quote:
|
Re: digital output frequency
Quote:
|
| All times are GMT -5. The time now is 12:59. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi