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

Back to Subject List

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


 
#6933 - Please correct the following code
The program that I have included needs to be checked. I would be greatly appreciated and thanks. When I run this program in my PROVIEW software, the P1 port on the simulator just stays on 0 and its suppose to step like this 8 , pause for few seconds,4, pause,2,pause,1 and vice versa. here is the code.:



;Date: September 17 - November 30th.
;Program: Unipolar Stepper Motor 'sequence'
;Simulation on the * 8051 Based Architecture Microcontroller *
;System: Pentium 300 MHz. ( Microsoft Windows 2000 Professional ). Build 2195

;-----------------------------------------------------------------------------------------------------------------------------------------------------------


CALL ROLLSTOP


START: ;CHECK TO SEE IF P3, PIN 0 IS ON

MOV A, P3 ;
ORL A, #00000001B
MOV P3, A
MOV A, P3
ANL A, #00000001B
;IF ON, THEN CONTINUE. IF NOT, LOOP TO START.
JZ START

;-----------------------------------------------------------------------------------------------------------------------------------------------------------

INITPAUSE: ;WAIT 1sec TO START RUNNING

MOV A, #98
CALL WAITS

;-----------------------------------------------------------------------------------------------------------------------------------------------------------

FORWARD: ;SET MOTOR IN FORWARD MOTION

CALL INITFORWARD
CALL WAITS
CALL PAUSE
CALL ROLLSTOP

;-----------------------------------------------------------------------------------------------------------------------------------------------------------


;CCW 90, AND MOVE CLOCKWISE
;CALL PAUSE

;RCCW
;CALL PAUSE

;-----------------------------------------------------------------------------------------------------------------------------------------------------------

REVERSE:
;SET MOTOR IN REVERSE MOTION
CALL INITREV
CALL WAITS
CALL ROLLSTOP
CALL PAUSE

;-----------------------------------------------------------------------------------------------------------------------------------------------------------



WAITS: ;FULL WAITS ( SHORT ) IS APPROX. 1.62 sec


MOV R2, A
;WAIT1:
;MOV R0, #11111111B
;MOV R1, #00001010B
WAIT2:
DJNZ R0, WAIT2
MOV R0, #00000011B
DJNZ R1, WAIT2
;DJNZ R2, WAIT1
RET


;-----------------------------------------------------------------------------------------------------------------------------------------------------------


PAUSE:
MOV A, #49 ;PAUSE 1/2sec AFTER MOVING
CALL WAITS
RET


;-----------------------------------------------------------------------------------------------------------------------------------------------------------

INITFORWARD: ;The unipolar stepper motor begins in motion ( Phase 1)
;SET FORWARD MOTION
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


;-----------------------------------------------------------------------------------------------------------------------------------------------------------


INITREV: ;The unipolar stepper motor begins its backward motion ( Phase 2)
;SET REVERSE MOTION
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 11 messages in thread
TopicAuthorDate
Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
RE: Please correct the following code            01/01/70 00:00      
Add more routines to my program.            01/01/70 00:00      

Back to Subject List