Problem Controlling Continuous Rotation Servo to 90 degrees
i have written an assembly language source code, as shown below to control the Continuous Rotation servo motor, such that it rotates CLOCKWISE 90 degrees and stop momentarily until the next input is triggered. Then it rotates CLOCKWISE again 90 degrees and stop. the process repeats.
Run
movlw 0x0C
movwf COUNT_2
loopd
decfsz COUNT_2,f
goto One
return
One
BSF PORTB,7
CALL Delay
BCF PORTB,7
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
GOTO loopd
Delay
movlw 0xF9
movwf COUNT_1
loop
decfsz COUNT_1,f
goto loop
RETURN
i understand that this method is different from the conventional time-pulse method. Initially, it worked sort of well for the first few rotations, but gradually the position is no longer perpendicular.
is there any explaination for this? or even better, can anyone provide an example program to execute the desired movement? i am looking forward to receiving replies a.s.a.p, as i urgently need to solve this for my final year project. thanks!
Run
movlw 0x0C
movwf COUNT_2
loopd
decfsz COUNT_2,f
goto One
return
One
BSF PORTB,7
CALL Delay
BCF PORTB,7
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
GOTO loopd
Delay
movlw 0xF9
movwf COUNT_1
loop
decfsz COUNT_1,f
goto loop
RETURN
i understand that this method is different from the conventional time-pulse method. Initially, it worked sort of well for the first few rotations, but gradually the position is no longer perpendicular.
is there any explaination for this? or even better, can anyone provide an example program to execute the desired movement? i am looking forward to receiving replies a.s.a.p, as i urgently need to solve this for my final year project. thanks!
Comments
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support