Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help:Mains AC synced PWM sine output?

Status
Not open for further replies.

abicash

Member
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.

Can someone explain at top level, how this is done or can be done?

All help appreciated
 
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.
 
Dear alec
Thanks for replying

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
 
You asked for an explanation "at top level". Sorry, but I have little experience of programming. There are others here better qualified to advise on the software details.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top