Stepper Motor interfacing with 8051 - Assembly Program Code - Proteus Stimulation - Keil - AT89C51
The program is stimulated in proteus, compiled in Keil for 8051 - AT89C51 in assembly language.
Program for stepper motor interfacing with 8051 in assembly language using proteus and uvision,
Flowchart:-
Proteus Stimulation:-
Program:-
ORG 00H
MOV TMOD,#10H
MOV R1,#99H
MOV P2,#00H
MOV P1,#0FFH
MOV R3,#00H
MOV R4.#00H
ACALL DELAY
MAIN: MOV A,P1
ANL A,#0FH
MOV R2,A
MOV B.R3
SUBB A,B
JC CRY
CJNE A.#00H,LOO
MOV A,R2
MOV R3,A
SJMP MAIN
LOO: MOV R5, A
MOV A,R2
MOV R3, A
XCH A, R5
MOV B,#06
MUL AB
SJMP FWD
CRY: CPL A
INC A
MOV B,#06
MUL AB
MOV R5,A
MOV A.R2
MOV R3,A
XCH A, R5
SJMP BWD
FWD: MOV R0, A
MOV A,R1
FWD1: RL A
MOV P2, A
ACALL DELAY
ACALL DELAY
ACALL DELAY
ACALL DELAY
ACALL DELAY
DJNZ R0, FWD1
SJMP MAIN
BWD : MOV R0,A
MOV A,R1
BWD1: RR A
MOV P2,A
ACALL DELAY
ACALL DELAY
ACALL DELAY
ACALL DELAY
ACALL DELAY
DJNZ R0, BWD1
SJMP MAIN
DELAY: MOV TL1,#00H
MOV TH1,#00H
SETB TR1
HERE:JNB TF1,HERE
CLR TR1
CLR TF1
RET
END
For more ASM programs - click here