org 0h
start: mov p0,#11101111b
call delay
mov p0,#11011111b
call delay
mov p0,#10111111b
acall delay
mov p0,#01111111b
acall delay
sjmp start
delay: mov r0,#0
delay1: mov r2,#0fh
djnz r2,$
djnz r0,delay1
ret
end
2. Menggerakkan motor langkah dengan tombol tekan
org 0h
start: jb p2.0,CW
call stepCCW
sjmp start
CW: call stepCW
sjmp start
stepCW: mov p0,#11101111b
call delay
mov p0,#11011111b
call delay
mov p0,#10111111b
call delay
mov p0,#01111111b
call delay
ret
stepCCW: mov p0,#01111111b
call delay
mov p0,#10111111b
call delay
mov p0,#11011111b
call delay
mov p0,#11101111b
call delay
ret
delay: mov r0,#0
delay1: mov r2,#0fh
djnz r2,$
djnz r0,delay1
ret
end
*Untuk melihat file rangkaiannya dapat dilihat disini.