Well, I'm not sure if it's because we're doing an entirely different think, but his pwm function is 105 lines. Mine is 26. Here is mine so far (the part I asked this question about goes after the on and off instructions, replacing the porta,0: pwm incf pwmtimer movlw 0FFh movwf _255 movlw 08h movwf FSR0L clrf FSR0H pwmloop1 movf pwmtimer,w subwf _255,w addwf INDF0,w btfss STATUS,C goto on goto off on bsf porta,0 goto endpwmloop1 off bcf porta,0 goto endpwmloop1 endpwmloop1 decfsz FSR0L,f goto pwmloop1 retlw 0 This had been tested, and works nicely. -- Dave All us base are belong to you. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist