Das
Newbie level 3
check my circuit
hi every one,
i am designing a stepper motor controller using 8051 microcontroller, my ckt is not working (stepper motor is not running), i am using unipolar 6 wire stepper motor. i don know where the problem is.
this is my code:
NAME STEPPER_MOTOR
;USING 0 ; Register-Bank 0
; Execution starts at address 0 on power-up.
;JMP START
; first set Stack Pointer
START: JMP OVER
; Continuously check whether any key is pressed
POLL: MOV A, P3
CJNE A, #0FFH, CHECK_P3
JMP POLL
; Find which key is pressed and call the ROTATE
CHECK_P3: RRC A
JNC ROTATE
INC R1
JMP CHECK_P3
; Used to rotate the Stepper Motor
ROTATE: CJNE R1, #4H, NXT_LOGIC
CALL CLOCKWISE
JMP OVER
NXT_LOGIC: CJNE R1, #5H, NXT_LOGIC_2
CALL ANTI_CLOCK
JMP OVER
NXT_LOGIC_2: CJNE R1, #6H, NXT_LOGIC_3
CALL NEW_LOGIC
JMP OVER
NXT_LOGIC_3: ; CJNE R1, #7H, NXT_LOGIC_4
CALL NEW_LOGIC_ONE
JMP OVER
;NXT_LOGIC_4: CJNE R1, #8H, NXT
;MOTOR_SEL: CJNE R1, #6H, OVER
; CALL SELECT_MOTOR
; JMP OVER
; Rotate the Stepper Motor clockwise direction
;CLOCKWISE: MOV R1, #32H
CLOCKWISE: MOV R1, #0FFH
GO_CLOCK: MOV P2, #0CH
CALL DELAY
MOV P2, #06H
CALL DELAY
MOV P2, #03H
CALL DELAY
MOV P2, #09H
CALL DELAY
DJNZ R1, GO_CLOCK
RET
ANTI_CLOCK: MOV R1, #32H
;ANTI_CLOCK: MOV R1, #0FFH
GO_ACLOCK: MOV P2, #05H
CALL DELAY
MOV P2, #0AH
CALL DELAY
;MOV P2, #04H
;CALL DELAY
;MOV P2, #02H
;CALL DELAY
DJNZ R1, GO_ACLOCK
RET
NEW_LOGIC: MOV R1, #0FFH
GO_NLOGIC: MOV P2, #08H
CALL DELAY
MOV P2, #04H
CALL DELAY
MOV P2, #02H
CALL DELAY
MOV P2, #01H
CALL DELAY
DJNZ R1, GO_NLOGIC
RET
NEW_LOGIC_ONE: MOV R1, #0FFH
GO_NLOGIC_ONE: MOV P2, #08H
CALL DELAY
MOV P2, #0CH
CALL DELAY
MOV P2, #04H
CALL DELAY
MOV P2, #06H
CALL DELAY
MOV P2, #02H
CALL DELAY
MOV P2, #03H
CALL DELAY
MOV P2, #01H
CALL DELAY
MOV P2, #09H
CALL DELAY
DJNZ R1, GO_NLOGIC_ONE
RET
;SELECT_MOTOR: JB P3.6, AZIMUTH_MOTOR
; MOV R0, #80H
; MOV @R0, #01H
; JMP OVER
;AZIMUTH_MOTOR: MOV R2, P2
; JMP OVER
; Initialize the Ports and return back to polling mode
OVER: MOV R1, #00H
MOV P2, #00H
MOV P3, #0FFH
;MOV R0, 01H
JMP POLL
; it will insert the delay of 30ms
DELAY: MOV R5, #1EH
;DELAY: MOV R5, #0FFH
LOOP: MOV R4, #0FAH
LEVEL2: NOP ; approx nop take 2.0 microsecond
NOP
;NOP
;NOP
;NOP
DJNZ R4, LEVEL2
DJNZ R5, LOOP
RET
END
help me, Thanks in advance
Das
hi every one,
i am designing a stepper motor controller using 8051 microcontroller, my ckt is not working (stepper motor is not running), i am using unipolar 6 wire stepper motor. i don know where the problem is.
this is my code:
NAME STEPPER_MOTOR
;USING 0 ; Register-Bank 0
; Execution starts at address 0 on power-up.
;JMP START
; first set Stack Pointer
START: JMP OVER
; Continuously check whether any key is pressed
POLL: MOV A, P3
CJNE A, #0FFH, CHECK_P3
JMP POLL
; Find which key is pressed and call the ROTATE
CHECK_P3: RRC A
JNC ROTATE
INC R1
JMP CHECK_P3
; Used to rotate the Stepper Motor
ROTATE: CJNE R1, #4H, NXT_LOGIC
CALL CLOCKWISE
JMP OVER
NXT_LOGIC: CJNE R1, #5H, NXT_LOGIC_2
CALL ANTI_CLOCK
JMP OVER
NXT_LOGIC_2: CJNE R1, #6H, NXT_LOGIC_3
CALL NEW_LOGIC
JMP OVER
NXT_LOGIC_3: ; CJNE R1, #7H, NXT_LOGIC_4
CALL NEW_LOGIC_ONE
JMP OVER
;NXT_LOGIC_4: CJNE R1, #8H, NXT
;MOTOR_SEL: CJNE R1, #6H, OVER
; CALL SELECT_MOTOR
; JMP OVER
; Rotate the Stepper Motor clockwise direction
;CLOCKWISE: MOV R1, #32H
CLOCKWISE: MOV R1, #0FFH
GO_CLOCK: MOV P2, #0CH
CALL DELAY
MOV P2, #06H
CALL DELAY
MOV P2, #03H
CALL DELAY
MOV P2, #09H
CALL DELAY
DJNZ R1, GO_CLOCK
RET
ANTI_CLOCK: MOV R1, #32H
;ANTI_CLOCK: MOV R1, #0FFH
GO_ACLOCK: MOV P2, #05H
CALL DELAY
MOV P2, #0AH
CALL DELAY
;MOV P2, #04H
;CALL DELAY
;MOV P2, #02H
;CALL DELAY
DJNZ R1, GO_ACLOCK
RET
NEW_LOGIC: MOV R1, #0FFH
GO_NLOGIC: MOV P2, #08H
CALL DELAY
MOV P2, #04H
CALL DELAY
MOV P2, #02H
CALL DELAY
MOV P2, #01H
CALL DELAY
DJNZ R1, GO_NLOGIC
RET
NEW_LOGIC_ONE: MOV R1, #0FFH
GO_NLOGIC_ONE: MOV P2, #08H
CALL DELAY
MOV P2, #0CH
CALL DELAY
MOV P2, #04H
CALL DELAY
MOV P2, #06H
CALL DELAY
MOV P2, #02H
CALL DELAY
MOV P2, #03H
CALL DELAY
MOV P2, #01H
CALL DELAY
MOV P2, #09H
CALL DELAY
DJNZ R1, GO_NLOGIC_ONE
RET
;SELECT_MOTOR: JB P3.6, AZIMUTH_MOTOR
; MOV R0, #80H
; MOV @R0, #01H
; JMP OVER
;AZIMUTH_MOTOR: MOV R2, P2
; JMP OVER
; Initialize the Ports and return back to polling mode
OVER: MOV R1, #00H
MOV P2, #00H
MOV P3, #0FFH
;MOV R0, 01H
JMP POLL
; it will insert the delay of 30ms
DELAY: MOV R5, #1EH
;DELAY: MOV R5, #0FFH
LOOP: MOV R4, #0FAH
LEVEL2: NOP ; approx nop take 2.0 microsecond
NOP
;NOP
;NOP
;NOP
DJNZ R4, LEVEL2
DJNZ R5, LOOP
RET
END
help me, Thanks in advance
Das