I am a beginner and I'll bet one of you servo experts can solve my problem in about 5 seconds. Undoubtedly I have made a code error. 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. I ran that part of the program by itself and displayed the results of pot position in binary on port b, everything worked fine. The leds displayed position from 1-255 (limit=255). When I combined the pot program with a servo program nothing happens. On power up the servo moves immediately to one position and does not respond to the pot position. If I ground PIC 16f84 pot position pin nothing happens unless I reset power where it will stay in a middle position. If I apply 5 volts nothing happens until a power reset. BO I have attached the code, if someone could review and comment I would be able to get on with my life. Thankyou Jon ;*******************************; ; MAIN ENTRY POINT ; ;*******************************; ORG 0X000 GOTO START ;*******************************; ; INTERRUPT SERVICE CODE ; ;*******************************; ORG 0X004 RETFIE ;return from interrupt ;*******************************; ; SETUP PORTS Etc. ; ;*******************************; START MOVLW B'10000111' OPTION ;set up the OPTION register MOVLW B'00000000' MOVWF 0BH ;Set up the INTCON register MOVLW B'00000000' TRIS PORTA ;setup port A BITs 0-3 as OUTPUT MOVWF PORTA ;clear port A MOVLW B'11111111' TRIS PORTB ;setup port B BITs 0-7 as INPUT ; MOVLW 080H ;Setup SERVOS to CENTRE ; MOVWF PULSE1S ;Servo 1 Initial Position ; MOVWF PULSE2S ;Servo 2 Initial Position ; MOVLW 040H ; MOVWF PULSE1PS1 ; MOVWF PULSE2PS1 ; MOVLW 0C0H ; MOVWF PULSE1PS2 ; MOVWF PULSE2PS2 ;*******************************; ; MAIN LOOP ; ;*******************************; ; FIRST SERVO ; ;*******************************; BEGIN MOVFW PULSE1S ;LOAD Pulse Store MOVWF PULSE1 ;LOAD Pulse Counter MOVLW 0FAH ;Load 1ms. counter MOVWF DELAY1 ;Get it into reg BSF PORTA,0 ;Start pulse output HIMS1 NOP ;Force loop into 4 cycle duty (even #) DECFSZ DELAY1,F ;Decriment Counter DELAY1 GOTO HIMS1 ;No yet Zero -> Goto HIMS1 HIGH1 NOP ;Force loop into 4 cycle duty (even #) DECFSZ PULSE1,F ;Decriment PULSE1 GOTO HIGH1 ;Not Yet Zero -> Gotot HIGH1 BCF PORTA,0 ;End pulse output ;***********************************; ; EXTEND TO FULL 2 mSEC PULSE WIDTH ; ;***********************************; MOVFW PULSE1S ;get the register position value SUBLW 0FAH ;subtract it from 250 MOVWF PULSE1 ;place the difference in the counter LOW1 NOP ;force loop into 4 cycle duty (even #) DECFSZ PULSE1,F ;loop for high part of duty cycle GOTO LOW1 ;while pulse > 0 ;***********************************; ; READ INPUT POT B0 ; ;***********************************; UP_DOWN CLRF PULSE1S ;Clear previous value MOVLW B'11111110' ;setup port B BITs as OUTPUT TRIS PORTB ; BSF PORTB,0 ;START CAPACITOR CHARGE NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge NOP ;Time to charge MOVLW b'11111111' ;Set PortB,0 to input TRIS PORTB ;Teach portA 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 ;***********************************; ; DUTY CYCLE DELAY LOOP 15 mSEC ; ;***********************************; LOOP15 MOVLW 0FH ;load the value of 15 MOVWF DELAY2 ;store it in counter Delay2 DUTY1 MOVLW 0FAh ;load the value of 250 MOVWF DELAY1 ;Store it int the counter delay1 DUTY2 NOP ;force loop into 4 cycle duty (even #) DECFSZ DELAY1,F ;Decriment Delay1 GOTO DUTY2 ;if not zero -> Goto DUTY2 DECFSZ DELAY2,F ;Decriment Delay2 GOTO DUTY1 ;if not zero -> Goto DUTY1 FINAL GOTO BEGIN ;restart the MAIN Programme loop ; ERROR_ SLEEP ;Hmm if we got here we ha END ;The End