- Back to Home »
- Half Stepper motor , stepper motor , Stepper motor with speed controller »
- Program for half stepper motor
half stepper motor:
ORG 0000H
MOV P2,#00H ;initialize as o/p 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,0ch,04h,06h,02h,03h,01h,09h,0
END