- Back to Home »
- Full Stepper Motor , stepper motor , Stepper motor with speed controller »
- Program for full stepper motor
full stepper motor:
ORG 0000H
MOV P2,#00H ;initialize as op port
/*
////////////////////////////////////////METHOD-2 HALF STEPPING//////////////////////////////////////////
exit:
mov dptr,#msg
rpt:clr a
movc a,@a+dptr
jz exit
inc dptr
mov p2,a
acall delay
sjmp rpt */
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////METHOD-1//////////////////////////////////////////
MOV A,#66H
AGAIN:MOV P2,A
JNB P1.0,NXT ;check status of switch
RR A
ACALL DELAY
SJMP AGAIN
NXT:RL A
ACALL DELAY
SJMP AGAIN
/////////////////////////////////////////////////////////////////////////////////////////////
DELAY:
MOV R1,#01H
H3:MOV R2,#0FFH
H2:MOV R3,#0FFH
H1:DJNZ R3,H1
DJNZ R2,H2
DJNZ R1,H3
RET
msg:
db 08h,04h,02h,01h,0
END
CLICK HERE TO SEE CIRCUIT DIAGRAM
ORG 0000H
MOV P2,#00H ;initialize as op port
/*
////////////////////////////////////////METHOD-2 HALF STEPPING//////////////////////////////////////////
exit:
mov dptr,#msg
rpt:clr a
movc a,@a+dptr
jz exit
inc dptr
mov p2,a
acall delay
sjmp rpt */
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////METHOD-1//////////////////////////////////////////
MOV A,#66H
AGAIN:MOV P2,A
JNB P1.0,NXT ;check status of switch
RR A
ACALL DELAY
SJMP AGAIN
NXT:RL A
ACALL DELAY
SJMP AGAIN
/////////////////////////////////////////////////////////////////////////////////////////////
DELAY:
MOV R1,#01H
H3:MOV R2,#0FFH
H2:MOV R3,#0FFH
H1:DJNZ R3,H1
DJNZ R2,H2
DJNZ R1,H3
RET
msg:
db 08h,04h,02h,01h,0
END
CLICK HERE TO SEE CIRCUIT DIAGRAM