Dear PICsters,

please help me out with this servo ontrol code for my robot, i will rewrite the code to suit two servos after i get it to work with one. the code compiles but it doesn't work?

here is my single servo control code


;"SmartBot Servo Test Program - Written By Daniel"
;This program control a single servo.
INCLUDE "P16F84.INC"

BSF     STATUS,RP0         ;Set register bank 1
CLRF    TRISA      ;Set All PORTA Pins to outputs

Counter         EQU     0Ch             ;Servo delay counter register
Position        EQU     0Dh             ;Servo Position register

#DEFINE  Servo1  PORTA,0  ;Defines Servo (A.0) I/O Pin on PIC16F84


Servo           MOVLW   0               ;Load Counter with # of cycles for
                MOVWF   Counter         ;1 ms Servo Delay
                BSF     Servo1          ;Activate the Servo output
                CALL    Delay           ;Wait for 1ms to pass
                MOVF    90,0            ;Load W with servo posi tion
                                        ;00 & FF=extremes, 128=centre
                MOVWF   Counter         ;and store in Counter for next delay
                CALL    Delay           ;Keep servo active for position delay
                GOTO Servo  ;Create Loop

Delay           ;Servo time delay
                NOP                     ;Pad the loop with one cycle
                DECFSZ  Counter         ;Counter=Counter-1
                GOTO    Delay           ;If Counter is not 0, repeat
                RETURN                  ;If 0, return

END

       
Thankyou

Anamalech

 
Web: www.anamalech.multiservers.com
 
Email: anamalech@hotmail.com


MSN Photos is the easiest way to share and print your photos: Click Here
-- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.