On Sat, 10 Jan 1998 11:34:40 EST PHXSYS writes: >I am trying to control the position of a R/C servo using a Pot. I am >timing >the discharge of a capacitor to determine the pot position. [...] > MEAS1 CLRWDT > BTFSS PORTB,0 ;Test b0 skip if 1 > GOTO UP_DOWN > INCFSZ PULSE1S,F ;Inc pulse1s skip if 0 > GOTO MEAS1 ; >CLEANUP MOVLW 0XFF > MOVF PULSE1S,W As written, there is no way out of the measurement routine except when PULSE1S overflows to 0. You don't ever want to go back to UP_DOWN (taking a new measurement) except as part of the main loop after doing a servo pulse with the old measurement. Rewrite it to something like: meas_lp btfss PORT_B,0 ;When cap has discharged, goto meas_done ;measurement done. incfsz PULSE1S,f ;Inc. measured value goto meas_lp ;If no overflow, wait more decf PULSE1S,f ;Fix overflow value back to 255 meas_done The "cleanup", whatever it's supposed to do, appears unnecessary. Make sure the WDT prescaler is set high enough to guarantee that the WDT won't run out during the 20 ms main loop. Then clear it just at the start of each main loop. It would help to write the delay, cap measure, etc. sections as subroutines. This makes it easier to follow the flow through the main loop as well as expand the function of the program later.