Akhil Mohan
Member level 2

Hello,
Please go through the code to generate a pulse of 10% duty cycle and 250Hz ( for CCS C compiler)
Thanks in advance,
Akhil
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);
}
Thanks in advance,
Akhil
Last edited: