Anda di halaman 1dari 17

Percobaan Motor Stepper

Percobaan 1: Driver Motor Stepper

+5

16

15

14

13

12

11

10

9
1

8
PA0 1 18 XD0

PA0 2 17 XD1

PA0 3 16 XD2

PA0 4 15 XD3

PA0 14 XXD0
5

PA0 6 13 XXD1

PA0 7 12 XXD2

PA0 8 11 XXD3
9 10

VCC

Gambar 4.1. Driver Motor Stepper

Gambar Diatas adalah driver Motor Stepper IN CHIP ULN 2803. Dimana didalamnya
terdapat deretan transistor penguat arus sekaligus berfungsi sebagai IVERTER. Jadi data yang
dikirim harus ber KOMPLEMEN dengan data Motor Stepper.
Kecepatan Motor Stepper hanya bisa diatur dengan delay ( penundaan waktu ) antara data
sebelum dengan data sesudahnya.
Contoh Program 1:
DATA D3 D2 D1 D0
14 1 1 1 0
13 1 1 0 1
11 1 0 1 1
7 0 1 1 1

;LESS17.ASM DIGUNAKAN UNTUK MOTOR STEPPER


CODE_SEG SEGMENT ; code_seg Sebagai segment
ASSUME CS:CODE_SEG, DS:CODE_SEG,SS:CODE_SEG
ORG 100H ; program ditulis mulai origin 100hh
start: jmp mulai ; awal program pada Org 0100h
porta equ 00h ; menentukan alamat port A,B,C
portb equ 01h ; dan ctrword sesuai dengan
portc equ 02h ; hardwarenya
cw equ 03h
mulai:
mov al,80h ; init ppi
mov dx,cw ; 80H MODE =0
out dx,al ; port A,B,C output

putar:
mov al,14
mov dx,porta
out dx,al
call delay
mov al,13
mov dx,porta
out dx,al
call delay
mov al,11
mov dx,porta
out dx,al
call delay
mov al,7
mov dx,porta
out dx,al
call delay
jmp putar
delay proc near
push cx
mov cx,0FFFFH
loop $
pop cx
ret
delay endp
ORG 20F0h ; alamat yang dituju setelah reset
db 0EAh ; JMP reset ke
dw 0100h ; alamat offset 0100H
dw 0FDF0h ; alamat segmen 0FBFh
code_seg ends ; batas segment code_seg
end start ; akhir program
Pertanyaan :
Kemanakah Pergerakan dari Motor Stepper : Kiri
Gantilah delay, dan amatilah pergerakanya. Semakain besar delay semakin
LAMBAT gerakan stepper dan semakin kecil delay. Semakin CEPAT gerakan
Steppernya.

Contoh Program 2:
DATA D3 D2 D1 D0
7 0 1 1 1
11 1 0 1 1
13 1 1 0 1
14 1 1 1 0

;LESS 18.ASM DIGUNAKAN UNTUK MOTOR STEPPER


CODE_SEG SEGMENT ; code_seg Sebagai segment
ASSUME CS:CODE_SEG, DS:CODE_SEG,SS:CODE_SEG
ORG 100H ; program ditulis mulai origin 100hh
start: jmp mulai ; awal program pada Org 0100h
porta equ 00h ; menentukan alamat port A,B,C
portb equ 01h ; dan ctrword sesuai dengan
portc equ 02h ; hardwarenya
cw equ 03h

mulai:
mov al,80h ; init ppi
mov dx,cw ; 80H MODE =0
out dx,al ; port A,B,C output
putar:
mov al,7
mov dx,porta
out dx,al
call delay
mov al,11
mov dx,porta
out dx,al
call delay
mov al,13
mov dx,porta
out dx,al
call delay
mov al,14
mov dx,porta
out dx,al
call delay
jmp putar

delay endp
ORG 20F0h ; alamat yang dituju setelah reset
db 0EAh ; JMP reset ke
dw 0100h ; alamat offset 0100H
dw 0FDF0h ; alamat segmen 0FBFh
code_seg ends ; batas segment code_seg
endstart ; akhir program

Pertanyaan :
Kemanakah arah pergerakan Motor Stepper : Kanan

Contoh Pogram 3 :
DATA D3 D2 D1 D0
14 1 1 1 0
12 1 1 0 0
13 1 1 0 1
9 1 0 0 1
11 1 0 1 1
3 0 0 1 1
7 0 1 1 1

;LESS 19.ASM DIUNAKAN UNTUK MOTOR STEPPER


CODE_SEG SEGMENT ; code_seg Sebagai segment
ASSUME CS:CODE_SEG, DS:CODE_SEG,SS:CODE_SEG
ORG 100H ; program ditulis mulai origin 100hh
start: jmp mulai ; awal program pada Org 0100h
porta equ 00h ; menentukan alamat port A,B,C
portb equ 01h ; dan ctrword sesuai dengan
portc equ 02h ; hardwarenya
cw equ 03h

mulai:
mov al,80h ; init ppi
mov dx,cw ; 80H MODE =0
out dx,al ; port A,B,C output
putar:
mov al,14
mov dx,porta
out dx,al
call delay
mov al,12
mov dx,porta
out dx,al
call delay
mov al,13
mov dx,porta
out dx,al
call delay
mov al,9
mov dx,porta
out dx,al
call delay
mov al,11
mov dx,porta
out dx,al
call delay
mov al,3
mov dx,porta
out dx,al
call delay
mov al,7
mov dx,porta
out dx,al
call delay
jmp putar
delay proc near
push cx
mov cx,0FFFFH
loop $
pop cx
ret
delay endp
ORG 20F0h ; alamat yang dituju setelah reset
db 0EAh ; JMP reset ke
dw 0100h ; alamat offset 0100H
dw 0FDF0h ; alamat segmen 0FBFh
code_seg ends ; batas segment code_seg
endstart ; akhir program

Pertanyaan :
Kemanakah arah pergerakan Motor Stepper : Kiri
Perbedaan Apa Yang diperoleh dari Program 1 :
Contoh Pogram 4 :
DATA D3 D2 D1 D0
7 0 1 1 1
3 0 0 1 1
11 1 0 1 1
9 1 0 0 1
13 1 1 0 1
12 1 1 0 0
14 1 1 1 0

;LESS20.ASM DIGUNAKAN UNTUK MOTOR STEPPER


CODE_SEG SEGMENT ; code_seg Sebagai segment
ASSUME CS:CODE_SEG, DS:CODE_SEG,SS:CODE_SEG
ORG 100H ; program ditulis mulai origin 100hh
start: jmp mulai ; awal program pada Org 0100h
porta equ 00h ; menentukan alamat port A,B,C
portb equ 01h ; dan ctrword sesuai dengan
portc equ 02h ; hardwarenya
cw equ 03h

mulai:
mov al,80h ; init ppi
mov dx,cw ; 80H MODE =0
out dx,al ; port A,B,C output

putar:
mov al,7
mov dx,porta
out dx,al
call delay
mov al,3
mov dx,porta
out dx,al
call delay
mov al,9
mov dx,porta
out dx,al
call delay
mov al,13
mov dx,porta
out dx,al
call delay
mov al,12
mov dx,porta
out dx,al
call delay
mov al,14
mov dx,porta
out dx,al
call delay
jmp putar

delay proc near


push cx
mov cx,02222H
loop $
pop cx
ret
delay endp
ORG 20F0h ; alamat yang dituju setelah reset
db 0EAh ; JMP reset ke
dw 0100h ; alamat offset 0100H
dw 0FDF0h ; alamat segmen 0FBFh
code_seg ends ; batas segment code_seg
endstart ; akhir program

Pertanyaan :
Kemanakan arah pergerakan Motor Stepper : Kanan
Perbedaan apa yang anda peroleh dibandingkan program 2 :

Latihan : Membuat Portal Ps


CODE_SEG SEGMENT ; code_seg Sebagai segment
ASSUME CS:CODE_SEG, DS:CODE_SEG,SS:CODE_SEG
ORG 100H ; program ditulis mulai origin 100hh
start: jmp mulai ; awal program pada Org 0100h
porta equ 00h ; menentukan alamat port A,B,C
portb equ 01h ; dan ctrword sesuai dengan
portc equ 02h ; hardwarenya
cw equ 03h
mulai:
mov al,80h ; init ppi
mov dx,cw ; 80H MODE =0
out dx,al ; port A,B,C output
putar:

mov al,14 call delay out dx,al


mov dx,porta mov al,13 call delay
out dx,al mov dx,porta mov al,11
call delay out dx,al mov dx,porta
mov al,13 call delay out dx,al
mov dx,porta mov al,11 CALL DELAY
out dx,al mov dx,porta mov al,7
call delay out dx,al mov dx,porta
mov al,11 CALL DELAY out dx,al
mov dx,porta mov al,7 CALL DELAY
out dx,al mov dx,porta mov al,14
CALL DELAY out dx,al mov dx,porta
mov al,7 CALL DELAY out dx,al
mov dx,porta mov al,14 call delay
out dx,al mov dx,porta mov al,13
CALL DELAY out dx,al mov dx,porta
mov al,14 call delay out dx,al
mov dx,porta mov al,13 call delay
out dx,al mov dx,porta mov al,11
mov dx,porta call delay mov dx,porta
out dx,al mov al,11 out dx,al
CALL DELAY mov dx,porta call delay
mov al,7 out dx,al mov al,11
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,7 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,14 out dx,al mov al,7
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,14 out dx,al
call delay mov dx,porta CALL DELAY
mov al,13 out dx,al mov al,14
mov dx,porta call delay mov dx,porta
out dx,al mov al,13 out dx,al
call delay mov dx,porta call delay
mov al,11 out dx,al mov al,13
mov dx,porta call delay mov dx,porta
out dx,al mov al,11 out dx,al
CALL DELAY mov dx,porta call delay
mov al,7 out dx,al mov al,11
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,7 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,14 out dx,al mov al,7
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,14 out dx,al
call delay mov dx,porta CALL DELAY
mov al,13 out dx,al mov al,14
mov dx,porta call delay mov dx,porta
out dx,al mov al,13 out dx,al
call delay mov dx,porta CALL DELAY
mov al,13 out dx,al mov al,15
mov dx,porta call delay mov dx,porta
out dx,al mov al,13 out dx,al
call delay mov dx,porta CALL DELAY
mov al,11 out dx,al mov al,15
mov dx,porta call delay mov dx,porta
out dx,al mov al,11 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,7 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,7 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,14 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,14 out dx,al
call delay mov dx,porta CALL DELAY
mov al,13 out dx,al mov al,15
mov dx,porta call delay mov dx,porta
out dx,al mov al,13 out dx,al
call delay mov dx,porta CALL DELAY
mov al,11 out dx,al mov al,15
mov dx,porta call delay mov dx,porta
out dx,al mov al,11 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,7 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,15 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,14 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,14 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,15 out dx,al mov al,14
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,7 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,15 out dx,al mov al,7
mov dx,porta call delay mov dx,porta
out dx,al mov al,11 out dx,al
CALL DELAY mov dx,porta call delay
mov al,15 out dx,al mov al,11
mov dx,porta call delay mov dx,porta
out dx,al mov al,13 out dx,al
CALL DELAY mov dx,porta call delay
mov al,15 out dx,al mov al,13
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,14 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,15 out dx,al mov al,14
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,7 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,11 out dx,al mov al,7
mov dx,porta call delay mov dx,porta
out dx,al mov al,11 out dx,al
call delay mov dx,porta call delay
mov al,13 out dx,al mov al,11
mov dx,porta call delay mov dx,porta
out dx,al mov al,13 out dx,al
call delay mov dx,porta call delay
mov al,13 out dx,al
mov dx,porta call delay mov al,11
out dx,al mov al,13 mov dx,porta
CALL DELAY mov dx,porta out dx,al
mov al,14 out dx,al call delay
mov dx,porta CALL DELAY mov al,13
out dx,al mov al,14 mov dx,porta
CALL DELAY mov dx,porta out dx,al
mov al,7 out dx,al CALL DELAY
mov dx,porta CALL DELAY mov al,14
out dx,al mov al,7 mov dx,porta
call delay mov dx,porta out dx,al
mov al,11 out dx,al CALL DELAY
mov dx,porta call delay mov al,7
out dx,al mov al,11 mov dx,porta
call delay mov dx,porta out dx,al
mov al,13 out dx,al call delay
mov dx,porta call delay mov al,11
out dx,al mov al,13 mov dx,porta
CALL DELAY mov dx,porta out dx,al
mov al,14 out dx,al call delay
mov dx,porta CALL DELAY mov al,13
out dx,al mov al,14 mov dx,porta
CALL DELAY mov dx,porta out dx,al
mov al,7 out dx,al CALL DELAY
mov dx,porta CALL DELAY mov al,14
out dx,al mov al,7 mov dx,porta
call delay mov dx,porta out dx,al
mov al,11 out dx,al CALL DELAY
mov al,7 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,7 out dx,al
call delay mov dx,porta CALL DELAY
mov al,11 out dx,al mov al,15
mov dx,porta call delay mov dx,porta
out dx,al mov al,11 out dx,al
call delay mov dx,porta CALL DELAY
mov al,13 out dx,al mov al,15
mov dx,porta call delay mov dx,porta
out dx,al mov al,13 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,14 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,14 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,7 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,15 out dx,al
call delay mov dx,porta CALL DELAY
mov al,11 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,15 out dx,al
call delay mov dx,porta CALL DELAY
mov al,13 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov al,15 out dx,al
CALL DELAY mov dx,porta CALL DELAY
mov al,14 out dx,al mov al,15
mov dx,porta CALL DELAY mov dx,porta
out dx,al mov dx,porta mov al,15
CALL DELAY out dx,al mov dx,porta
mov al,15 CALL DELAY out dx,al
mov dx,porta mov al,15 CALL DELAY
out dx,al mov dx,porta
CALL DELAY out dx,al
mov al,15 CALL DELAY
JMP PUTAR
delay proc near
push cx
mov cx,02222H
loop $
pop cx
ret
delay endp
ORG 20F0h ; alamat yang dituju setelah reset
db 0EAh ; JMP reset ke
dw 0100h ; alamat offset 0100H
dw 0FDF0h ; alamat segmen 0FBFh
code_seg ends ; batas segment code_seg
endstart ; akhir program

Anda mungkin juga menyukai