|
|
Stepper
Motor Driving
The
stepper motor has five wires, one of those is the common, and remaining 4
wires are line 1 to 4. Each of this is connected to P1.0, P1.1, P1.2 and
P1.4

Figure
1. Circuit of stepper motor driver
$mod51
org 00h
jmp mulai
mulai:
mov r0, #55
ulang1:
mov p1, #00001000b
call tunda
mov p1, #00000100b
call tunda
mov p1, #00000010b
call tunda
mov p1, #00000001b
call tunda
djnz r0, ulang1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov r0, #55
ulang2:
mov p1, #00000001b
call tunda
mov p1, #00000010b
call tunda
mov p1, #00000100b
call tunda
mov p1, #00001000b
call tunda
djnz r0, ulang2
jmp mulai
tunda: mov r4, #20
maning: mov r5, #255
kurang: dec r5
cjne r5, #00h, kurang
djnz r4, maning
ret
end
|