PWM/ADC trouble

Thread Starter


Joined Jun 30, 2008
Hi there,

I am having a problem with the PWM and ADC modules of my PIC16F690. The program I am trying to write should do the following:

  • Display Lowest 4 bits of the ADC input on PORTC
  • Receive 8 lowest bits into Vin
  • On Timer2 interrupt (new PWM period), call the lookup table and return with the corresponding value.
  • Set the new duty cycle equal to this value.
  • Repeat
I chose the PWM frequency to be 15kHz, and will be sending the output into a low-pass filter. Also I chose ADC output to be right justified.
The problems I have:

  • The binary values don't show on PORTC
  • The PWM doesn't output anything.
Please can you help? The code is attached. Sorry for the format; I can't attach asm files.

Thanks :)