Hello
Posting something which was directed to Microcontroller forum.
Please help.
after which i was guided here.
Apology if the post has been too long to read, but i am sure learned forum members will definitely help
Posting something which was directed to Microcontroller forum.
Please help.
My OP
Hi
I require help from learned forum members regarding a general concept.
I have a sine weighted PWM generator from a microcontroller.
Simple question : How to determine synchronise the o/p frequency of sinewave with Mains frequency?
PWM freq = 8KHz
Microcontroller has 2 timers of which one is generating the 4 PWM o/ps
Also i have a Comparator module which can trigger this Timer1
or else i can use Timer2 in input capture mode to trigger Timer1 for PWM.
To which alec_t replied
You'd need to:
1) use a transformer to get a mains-isolated low voltage representation of the mains waveform,
2) detect zero-crossings or peaks of the waveform as reference points,
3) get the micro to spit out the sine-weighted values at the appropriate times relative to the reference points.
I replied
I have known 1) and 2) of your post.
I know 3) as per your explanation but just bear me through with my explanation, and point out if i am wrong..
Normally i start the Timer1 for sine-weighted values from a look up table (LUT) after a key press.In the overflow interrupts , i update the counter with updated value and then do housekeeping stuff.Next value is updated from incremented LUT index on next overflow, and so on till LUT is reinit at 0.
This process occurs or rather progresses naturally.
Now how do i integrate this with an input capture event (triggered by ZCD).
Would you suggest , reinitialize Timer1 at every edge of the ZCD, or should i reset the index counter of LUT to zero?
Please provide an insight
after which i was guided here.
Apology if the post has been too long to read, but i am sure learned forum members will definitely help