Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/07/00 18:27
Read: times


 
#7059 - add more routines
I need some additions to my program where I can variable the speed of the motor. How do I add the routines for making a stepper motor to go fast and slow in either directions-right and left. Also how do i make it so it will turn at certain angles like turn at 90 deg., 45,deg ets.


org 0000h
jmp main
org 0100h
main: CALL ROLLSTOP
mov p3,#11111111b
START: jb p3.0,forward ;PIN 3.0 IS ON - forward
jnb p3.0,reverse ;PIN 3.0 IS OFF - reverse
jmp start
;
FORWARD: MOV A,#98 ;WAIT 1sec TO START RUNNING
CALL WAITS
CALL INITFORWARD ;SET MOTOR IN FORWARD MOTION
CALL WAITS
CALL ROLLSTOP
jmp start ; ß---clockwise
;SET MOTOR IN REVERSE MOTION
REVERSE: MOV A,#98 ;WAIT 1sec TO START RUNNING
CALL WAITS
CALL INITREV
CALL WAITS
CALL ROLLSTOP
jmp start ; ß---counterclockwise
;
WAITS: MOV R2,A ;FULL WAITS (SHORT) IS APPR.1.62 sec
WAIT2: DJNZ R0,WAIT2
MOV R0,#00000011B
DJNZ R1,WAIT2
RET
;
PAUSE: MOV A,#49 ;PAUSE 1/2sec AFTER MOVING
CALL WAITS
RET
;
;SET FORWARD MOTION
INITFORWARD: ;The unipolar stepper motor begins in motion ( Phase 1)
MOV P1,#00000001B ;1
CALL PAUSE
MOV P1,#00000010B ;2
CALL PAUSE
MOV P1,#00000100B ;4
CALL PAUSE
MOV P1,#00001000B ;8
CALL PAUSE
RET
;
;SET REVERSE MOTION
INITREV: ;The unip. step. motor begins its backw. motion ( Phase 2)
MOV P1,#00001000B ;8
CALL PAUSE
MOV P1,#00000100B ;4
CALL PAUSE
MOV P1,#00000010B ;2
CALL PAUSE
MOV P1,#00000001B ;1
CALL PAUSE
RET
;
ROLLSTOP: MOV P1,#00000000B ;TURN OFF MOTOR
RET
END



List of 4 messages in thread
TopicAuthorDate
add more routines            01/01/70 00:00      
RE: add more routines            01/01/70 00:00      
RE: add more routines            01/01/70 00:00      
RE: add more routines            01/01/70 00:00      

Back to Subject List