Here is my servo code?

i am not sure how good it all is ? as i am new to mplab and assembly language!

but i think i may have gone wrong with the servo updates somewhere? ??? :)

each servo is on porta.0 and port a.1 of my 16f84? but i have only written some code for one servo? how do i implement two and get the code to work for me? eg. backwards,forwards?

Below is the code!

Thankyou all in advance

anamalech

;"SmartBot Servo Test Program - Written By Anamalech"
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 

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

       

 

 




 

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


Send and receive Hotmail on your mobile device: Click Here
-- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.