Quote Originally Posted by maus
what pic do you use ?

sample for 16f876:

TRISA = 255 ' Set PORTA als input
ADCON1 = 0
define OSC 8
DEFINE ADC_BITS 8 ' adc = 8 bits

v1 var byte 'Variable v1 holds pot information

high portc.2
pause 100
High portd.2 'power indicator

main:

adcin 0,v1 'Read resistance of pot
pause 10
Hpwm 1, v1, 10000 'hardware pwm on RC2

goto main


End

thanks for this code, but doesnt this base itself on the ADCIN producing a number from 0-255 to feed to the hpwm? I have made these changes and the LED's just stay on, even with adjustment of the pot. I dont think the variable output from the adcin is properly formatted for the hpwm

does anyone know how this is formatted? I cant find any documentation on it.