Hello everybody
I’m trying to make a robot but I’ve got few problem with servo controls.
i’m driving a servo by a pic16f84A but i’m not sure that my program is coccect.
I want to move the servo in the middle position so I give it a signal that is high(5V) for 1.5ms and low for 18.5ms and then I repeat.
This program put the min RA0 to high and than by many useless function it wait 1.5ms: I calculated 8000000^ -1 to check out the time that the pic need to do an instruction and than I made it count till it west 1.5 ms.
PROCESSOR 16F84A
RADIX DEC
INCLUDE “P16F84A.INC”
;ERROR LEVEL -302
__CONFIG 3FF1H
ORG 0CH
COUNT RES 2
ORG 00H
BSF STATUS,RP0
CLRF TRISA
CLRF TRISB
BCF STATUS,RP0
MAIN
BSF PORTA,0
MOVLW 00101111
MOVWF COUNT
MOVLW 00000000
MOVWF COUNT+1
CALL DELAY
BCF PORTA,0
CLRF COUNT
CLRF COUNT+1
CALL DELAY
CLRF COUNT
CLRF COUNT+1
CALL DELAY
MOVWF 00000001
MOVLW COUNT
MOVWF 01000010
MOVLW COUNT+1
CALL DELAY
MOVLW 00000001
MOVWF COUNT
MOVLW 10010100
MOVWF COUNT+1
CALL DELAY
GOTO MAIN
DELAY
DELAYLOOP
DECFSZ COUNT,1
GOTO DELAYLOOP
DECFSZ COUNT+1,1
GOTO DELAYLOOP
RETURN
END
I wrote this program but it doesn’t work but I don’t understand why.
Can some help me?