Hi to every one
I have worked and modify the code posted by ScaleRobotics and I manage to compile it for the PIC 16F877 and get 2 phase although my output was not very good. my aim is to generate 5kHZ SPWM so that when filtered will give sine waves(50hz). I havebeen reading different application manual and PIC16877 datashet for almost two days but I 'm still in darkness the problem comes for that frequency my duty cycle will have 10bit resolution. here are the questions.
(1) I Try to write the code to FOR 10 bit resolution to PWM module I dont think if is correct.
Code:
TeMP = sineval[STEPCOUNT]
CCP1CON.4 = Temp.0 ' bit 0
CCP1CON.5 = Temp.1 ' bit 1
CCPR1L = Temp.Byte0 >>2 '
(2)when I do my calculation
from microchip application note pwm_frequency=50hz*step*10
which gives me very low step about 10step which is very low when I try to use it my output become very distorted and only CCP1 gives output while ccp2 dont gives any output.
any one can help me how to get 5KHZ 36 step and is it nessary to modify my lookup table for 10bit resolution thankx
Bookmarks