- Back to Home »
- Stepper motor with speed controller »
- program for stepper motor with speed controller
ORG 0000H
MOV P0,#00H
MOV R0,#00
MOV P3,#0FFH
exit:
mov dptr,#msg
rpt2:clr a
movc a,@a+dptr
jz exit
inc dptr
mov p0,a
MOV A,P3
CJNE A,#0FEH,N2
MOV R0,#10
N2: CJNE A,#0FDH,N3
MOV R0,#20
N3: CJNE A,#0FBH,N4
MOV R0,#30
N4: CJNE A,#0F7H,N5
MOV R0,#40
N5: CJNE A,#0EFH,N6
MOV R0,#50
N6: acall delay
SJMP rpt2
/************************************************************************************/
/* DELAY SUBROUTINE */
/************************************************************************************/
DELAY: MOV R1,00
HERE2: MOV R2,#0FFH
HERE: DJNZ R2,HERE
DJNZ R1,HERE2
RET
msg:
db 08h,0ch,04h,06h,02h,03h,01h,09h,0
END