switimira
Member level 1
hi...can anybody help me modify this coding..this coding only generate 50% duty cycle..if possible i want to generate variable duty cycle..
program PWMBoost
main:
TRISC.2 = 0 ' CCP1 (PortC.2 = Output)
PR2 = 110 ' Set PWM Period for approximately 45KHz
CCPR1L = 55 ' Set PWM Duty-Cycle to 50%
CCP1CON = %00001100 ' Select PWM Mode
T2CON = %00000100 ' Timer2 = ON + 1:1 prescale
while true
wend
end.
Added after 2 hours 19 minutes:
i want to use push button connected to RA0..when the push button is press, it will change the duty cycle..can anybody help..please..
this is the schematic
program PWMBoost
main:
TRISC.2 = 0 ' CCP1 (PortC.2 = Output)
PR2 = 110 ' Set PWM Period for approximately 45KHz
CCPR1L = 55 ' Set PWM Duty-Cycle to 50%
CCP1CON = %00001100 ' Select PWM Mode
T2CON = %00000100 ' Timer2 = ON + 1:1 prescale
while true
wend
end.
Added after 2 hours 19 minutes:
i want to use push button connected to RA0..when the push button is press, it will change the duty cycle..can anybody help..please..
this is the schematic