just managed to get it to work with 3phases and to average them and output them... but im still unsure on the actual values. when a period is measured what does it get measured in? and how do i relate that to pwm?
just managed to get it to work with 3phases and to average them and output them... but im still unsure on the actual values. when a period is measured what does it get measured in? and how do i relate that to pwm?
Hi,
A closer look at your PIC Datasheet will show you HOW the CCP modules work ...
and from that ... What's the counting unit ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Well the timer measuring the period is being clocked by something, it apperars you're using the main oscillator as the source for that. Then there's a prescaler that can divide the main clock but it appears you have that set to 1:1. So if the PIC runs at 20MHz one timer "tick" is 200nS.
If the timer value is captured (and then reset) on the rising edge and you get a timer value of 1234 then the persiod is 1234*200nS = 246.8uS.
/Henrik.
hey thanks!
i had just worked that all out before i got the reply! but its just confirmed my calculations which is good. 0.2us is one timer tick so i know how to scale it all now.
i am having another problem if anyone can shed some light on it? im getting the right pulsewidth and the right frequency output (inrespect to my input) however its glitching every now and then and isnt giving me a perfectly smooth pwm output.
its glitching is not coinciding with tiny fluctuations in the input signal either...
could it be due to over measuring?
thanks!
i tried implementing the hpwm facility but it didnt seem to work for me very well... i cant remember what the problem was now but there was a reason i didnt use it. my pwm code i know works fine... ive got it working beautifully smooth from another pic... but when i add the code to capture and then output a signal that has nothing to do with the input signal it has random flickerings on the output...duncan303 Have you considered using the HWPM facilty?
Duncan
......
update:
i have got it working pretty nicely now, although i have added a 5 second pause to slow down updates.
there is very rarely a flickering now, which leads me to believe the highly frequent flickering before was caused by capturing and updating to quickly... why would this be tho?
Bookmarks