One of many possible approaches. Here the way I have done this.
First I generated my adjustable frequency using HPWM set to approximately 50% duty. Next I fed the output from CCP1 pin
to Portb.0 pin. Using DT interupts "INT_INT" set to trigger on the rising edge of my pwm signal. In the ISR the output pin was toggled
Basic concept
Not sure if you have enough pins using a 12f683 to do this and what ever else you need?Code:Setup HPWM Set INTCON to trigger on rising edge Main: Read Buttons or ADC Set HPWM Frequency Goto main Interupt Service Routine: gpio.x = 1 pauseus 5 gpio.x = 0 INT_RETURN




Bookmarks