There seems to be a lot of interest in creating sine waves. This example uses some of the principles of Microchip's AN655, (only using DT_INTS, HPWM, and lastly PCPWM). Not sure how clean my sine wave is, but it doesn't look too bad on the scope. Might be better if I trim the leads for my capacitors on the breadboard filter. Hopefully someone can have some fun with it. For more reading, and a great example, check out Sirvo's example here: http://www.picbasic.co.uk/forum/showthread.php?p=65843.
I changed the interrupt service routine type to be ASM to speed things up a bit. I had not realized that this could be done under certain conditions. As long as I am not multiplying or dividing in the service routine, it is ok to use PBP statements in an ASM type ISR. See Darrel's explanation here: http://www.picbasic.co.uk/forum/showthread.php?t=12399&p=82454#post82454 for more info. For three phase Power Control PWM , check out the bottom of this page.
With a few modifications to the code, a dual phase sine can be created. Had to change the step range from 32 steps to 36 steps, so I could get 120 degrees separation from the two sines.
And to change the frequency of the sine on the fly, simply uncomment this line:
'timerone = timerone - 1 'uncomment to vary 60hz sine
To get this:
And for 3 phase Power Control PWM 3 Phase Sine Code PBP, using a bit of Bruce's 18F2431 example ( look here for details http://www.picbasic.co.uk/forum/show...3820#post43820)
Sorry, I don't have a 3 channel scope to display it.