Generation of sine wave using SPWM in PIC16F684
I have previously shown how to calculate the values for the sine table. Now I will show you how to use that sine table for generating a sine wave using a PIC16F684. Why PIC16F684? It is a nice little 14-pin PIC that contains all that is needed for SPWM (sinusoidal pulse width modulation) – the ECCP module. Since the ADC or comparator or other peripherals are not used and there are enough pins, I selected the PIC16F684. You can find the tutorial here: http://www.blogspot.com/2016/01/generation-and-implementation-of-sine.html Let’s run the 16F684 from a 16MHz crystal oscillator and use a 16kHz switching frequency. So, the required value of PR2 is 249. The sine table (for half a cycle) is: 0, 25, 49, 73, 96, 118, 139, 159, 177, 193, 208, 220, 231, 239, 245, 249, 250, 249, 245, 239, 231, 220, 208, 193, 177, 159, 139, 118, 96, 73, 49, 25 '''''''''''''''''''''''''''''''...