well it seems Im having a conversation with myself, instead of busting the few neurones I have left, I used the second option (prescaler 1:16) and I made it work, but the glitches are still there.
I initialized the PMW before the main loop using: HPWM 0,0,1000
and the registers as:
T2CON = %00000110 ' timer2 on, prescale 1:16
PR2 = 62 'per pic calculator
and every time I wanted to adjust the duty cycle I entered the value in the duty variable and called this subroutine:
CCPR1L = duty>>2
CCP1CON=%00001100 | (duty<<5)
As I said...the glitches remain... if I stop reading the ADC they dissapear and the PWM is steady
HELP !
Bookmarks