Quote Originally Posted by Darrel Taylor View Post

Well, before you change pics. Can you give this program a quick try.
It's just a single channel, no interrupts. It runs at about 3.8khz

It should give an indication whether the higher frequencies of hardware PWM will help or not.
Code:
@ __CONFIG _HS_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_OFF 
DEFINE OSC 20
CLEAR
ANSEL=%00110001
CMCON=7
TRISA=%11111111        'set PORTA as all input 
TRISC=%00000001        'set PORTC as all output apart from RC0

PWM1       VAR PORTC.2
DutyCycle1 VAR WORD
GoDone     VAR ADCON0.1
ADCON1 = %00110000
ADCON0 = %00000011
while GoDone : wend

Main:
  if ADRESH > 1 then
    high PWM1
    DutyCycle1 = ADRESH
    GoDone = 1
    pauseUS DutyCycle1
    low  PWM1
    pauseUS 255 - DutyCycle1
    while GoDone : wend
  else
    low  PWM1
    GoDone = 1
    while GoDone : wend
  endif    
goto Main
Interesting..... works fine, no drop out or locking up after 20 or so tests. However the noise from the armature when starting is very loud and high pitched, with harmonics as you increase the throttle.

I tried reming out the last two channels as Steve suggested with the original code and I still experienced problems... but this new code works.