Use GOSUB VS GOTO if the routine you're going to uses RETURN to get back.
Disable onboard comparators with CMCON=7 before trying to use a pin that
has the comparator feature.
Give this a shot;
This should cycle your servo from one side to the other. Tested with aCode:@ __config _INTOSC_OSC_NOCLKOUT &_WDT_ON &_PWRTE_ON &_MCLRE_OFF &_BODEN_ON &_CP_OFF &_DATA_CP_OFF &_MCLRE_OFF servo1 var Porta.0 x var byte CMCON=7 ' <-- disable analog comparators low servo1 HIGH PORTB.3 loop: pause 500 low portb.3 pause 500 high portb.3 GOSUB move ' <-- use GOSUB VS GOTO pause 2000 low portb.3 GOTO loop move: for x = 200 to 100 STEP -1 ' 2mS to 1mS pulse pulsout servo1,x pause 18 next x pause 2000 for x = 100 to 200 ' 1mS to 2mS pulse pulsout servo1,x pause 18 next x pause 2000 return END
Parallax servo.




Bookmarks