Jun 15, 2011 #1 A Akhil Mohan Member level 2 Joined May 13, 2011 Messages 53 Helped 2 Reputation 4 Reaction score 2 Trophy points 1,288 Activity points 1,731 Hello, Please go through the code to generate a pulse of 10% duty cycle and 250Hz ( for CCS C compiler) #include <16F877A.h> #fuses XT,NOWDT,NOPROTECT,NOLVP,BROWNOUT,PUT #use delay(clock=4000000)// 4MHz main() ( output_low(PIN_C2); // Set CCP1 output low setup_ccp1(CCP_PWM); // Configure CCP1 as a PWM setup_timer_2(T2_DIV_BY_16,249, 1); // 250 Hz set_pwm1_duty(25); // 10% duty cycle on pin C2 while(1); } Click to expand... Thanks in advance, Akhil Last edited: Jun 15, 2011
Hello, Please go through the code to generate a pulse of 10% duty cycle and 250Hz ( for CCS C compiler) #include <16F877A.h> #fuses XT,NOWDT,NOPROTECT,NOLVP,BROWNOUT,PUT #use delay(clock=4000000)// 4MHz main() ( output_low(PIN_C2); // Set CCP1 output low setup_ccp1(CCP_PWM); // Configure CCP1 as a PWM setup_timer_2(T2_DIV_BY_16,249, 1); // 250 Hz set_pwm1_duty(25); // 10% duty cycle on pin C2 while(1); } Click to expand... Thanks in advance, Akhil
Jun 16, 2011 #2 A Akhil Mohan Member level 2 Joined May 13, 2011 Messages 53 Helped 2 Reputation 4 Reaction score 2 Trophy points 1,288 Activity points 1,731 I sorted out the error, i have inserted round brackets instead of curly