I've spent some time playing with an RC car controller and needed a very fast 2 channel PWM routine. Resolution was not important, so 8 steps (3 bits) was fine. My first attempt which I'm sure can easily be bettered: clrf outport ; clear shadow register incf pwmcount,w ; increment pwm counter andlw 0x07 ; 8 step PWM, so roll counter over after 7 movwf pwmcount movf pwmset1,w subwf pwmcount,w ; subtract setpoint from counter skpc bsf outport,0 ; result negative so turn on PWM output in shadow register movf pwmset2,w subwf pwmcount,w ; subtract setpoint from counter skpc bsf outport,1 ; result negative so turn on PWM output in shadow register So this gives a 4 cycle overhead for the counter and clearing the shadow register, and 4 cycles for each additonal channel. This actually gives nine steps; 0 gives 0%, 8 or greater gives 100%. I have seen Scott Dattalos very fast PWM routines, but they seem to incur too much overhead if the duty cycle needs to be varied. Regards Mike -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu