Hi all,
I cannot setup PWM on PIC16F1934 to get 38KHZ square wave on pin RC2. I followed examples, but i get frequencies that are way off. Has anyone had issues with that? I am using microC ver 5.0
Thanks,
cannot get correct PWM frequency from PIC16F1934
Re: cannot get correct PWM frequency from PIC16F1934
Hi,
i experience same problem using mikrobasic PRO for PIC compiler, with a "Start USB" board from MikroE : the actual PWM frequency measured with an oscilloscope on pin C2 is 4 to 5 times higher than the PWM1_Init(5000) programmed 5kHz frequency.
My programmed Delay_ms() are also shorter than what expected...
Wrong clock used as reference ???
regards.
i experience same problem using mikrobasic PRO for PIC compiler, with a "Start USB" board from MikroE : the actual PWM frequency measured with an oscilloscope on pin C2 is 4 to 5 times higher than the PWM1_Init(5000) programmed 5kHz frequency.
My programmed Delay_ms() are also shorter than what expected...
Wrong clock used as reference ???
regards.
- janko.kaljevic
- Posts: 3565
- Joined: 16 Jun 2011 13:48
Re: cannot get correct PWM frequency from PIC16F1934
Hello,
In both cases this looks like wrong oscillator settings.
Please check Project->Edit Project for oscillator selection and settings.
Best regards.
In both cases this looks like wrong oscillator settings.
Please check Project->Edit Project for oscillator selection and settings.
Best regards.
Re: cannot get correct PWM frequency from PIC16F1934
Hello,vgershman wrote:Hi all,
I cannot setup PWM on PIC16F1934 to get 38KHZ square wave on pin RC2. I followed examples, but i get frequencies that are way off. Has anyone had issues with that? I am using microC ver 5.0
Thanks,
It was my bad. I did not set up OSCCON register. Now works like a great.