PWM/ADC trouble

Discussion in 'Embedded Systems and Microcontrollers' started by Peytonator, Sep 16, 2009.

  1. Peytonator

    Thread Starter Active Member

    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 :)
    • PWM.doc
      File size:
      7.2 KB