Sinusoidal PWM generation with PIC16F877A

Status
Not open for further replies.

jinchang

New Member
Hello everyone,

I have posted some questions here in the past and I have received an enormous help from you. I really appreciate it so much. Now, I am having a really bad headache generating SPWM with PIC16F877A.

The method I am trying to use is to use Timer 2 interrupt and sine look up table to gerenate the SPWM in two outputs with different phases (e.g. one is sin, the other cosine, with same frequency).

I have successfully made the PWM of just an arbitrary shape using Timer 2 interrupt. however, the the output needs to be SPWM...

Can any of you experts give me some directions or sample code?

I am using 20MHz crystal and trying to make a code that generates SPWM of 1 Hz ~ 1000 Hz (frequency of the sinusoid) depending on the user input. The user interface part has been done already, and I need to generate the SPWM of the user's input now..

I have tried days to find a good website with that information, but I was not successful yet.

Thank you very much for you help once again!
 
You going to have trouble using PWM to simulate a sin wave over such a large frequency range as the PWM technique uses low pass filters to average the signal, so either you switch in some other passives at various frequencys or use a simple DAC like 2R ladder with a few opamps ...

At regular intervals use your look up table to stimulate the DAC settings and with an opamp ciruit give it a phase shift of 90 degrees for your cosine signal ! With this method you need only to construct a simple R2 ladder !
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…