If what you want is to generate 20Khz frequency using 16F88, then sure you can do it by using PWM feature of this PIC.
For 20Khz at 4Mhz, using 1:1 prescaler, PR2 should be 49.
At 20Mhz, 1:1, PR=249.
mister_e, pls correct me if I am wrong![]()
If what you want is to generate 20Khz frequency using 16F88, then sure you can do it by using PWM feature of this PIC.
For 20Khz at 4Mhz, using 1:1 prescaler, PR2 should be 49.
At 20Mhz, 1:1, PR=249.
mister_e, pls correct me if I am wrong![]()
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Yup PWM is the way to go. You can use the PBP HPWM or setting the PIC register as Sayzer said.
I got the same resultsOriginally Posted by Sayzer
![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I got it going with a 4Mhz oscillator. Here is the program.
I wanetd to use the 20Mhz oscillator. and it do not work. I change the 4 to a 20 in the program and changes the crystal and the capacitor to 22pF and it is not oscillating, anybody knows why. is there a command I nee to do ?
Define LOADER_USED 1
DEFINE OSC 4 'Using 4MHz oscillator
TRISB = 0
loop: FREQOUT PORTB.1,10000,20000 ' Turn on PORTB for 1- sec at20Khz
Pause 100 ' Delay for .5 seconds
Goto loop ' Go back to loop and blink LED forever
I am trying ot get a sin wave at the output. From the manuals of picbasic pro, they say to add a low pass filter, I did this, it dos remove the extra noise, but it does not make it a sinwave. Anybody know how to make it a sin wave ?
ken
Did you check this post?
http://www.picbasic.co.uk/forum/showthread.php?t=718
-------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
If it's for a single frequency with a 50% duty cycle you could still use a pair of integrator made with Op-Amp.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks