You are on page 1of 1

#include<18f4550.

h> #fuses NOWDT, NOMCLR, INTEC_IO #device adc=8 #use delay(clock=8MHz) void main() { setup_oscillator(OSC_8MHZ); setup_adc_ports(AN0); setup_adc(ADC_CLOCK_INTERNAL); set_adc_channel(0); setup_timer_1(T1_INTERNAL |T1_DIV_BY_1); setup_ccp1(CCP_PWM); CCP_2=4000; setup_ccp2(CCP_COMPARE_RESET_TIMER); enable_interrupts(INT_CCP2); enable_interrupts(GLOBAL); while(true); } #INT_CCP1 void lecturaEscritura() { set_pwm1_duty(read_adc());

You might also like