Definately Squarewave. This is about a third of the way on the POT.
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





Bookmarks