This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

soft ware pwm

Hi! I have written the code for software PWM whose PWM frequency is 20KHz

Method:
1) Generate PWM1 and PWM2 of 20KHz frequency using PWM command
2) wait for TMR2 to PR2 match interrupt Flag
3) when this flag=1 then high PWM3 port pin and start timer1 whose max delay is 50usec (20KHz)

but for 50% Duty Cycle I have reduce Timer1 delay to 25Usec by setting its TMR1H and TMR1L variables and jump to Step '1'

When Timer1 OV interrupt generated then i have low PWM3 Port Pin so its frequency is equal to 20Khz but i have received 0.146V on PWM3 port pin instead of 2.5V and it is not working correctly , i have also attached the code if anybody find the mistake then it will be highly appreciated

--------------------------------------------------------------------------------

C:\\documents and setings\\mandeep\\my projects\\PWM.txt (7.56 GB)

Parents Reply Children
No data