Sei sulla pagina 1di 12

ILHAM RAHMAT KURNIA 2009 - 11 - 116

1. Modul IO
a. Tuliskan program untuk membuat LED berjalan dengan alamat port C. CODE_SEG SEGMENT ASSUME CS:CODE_SEG,DS:CODE_SEG,SS:CODE_SEG ORG 100H start: jmp mulai porta portb portc cw equ 00h equ 01h equ 02h equ 03h

mulai: mov mov out ulang: mov mov putar: mov out call shl loop jmp

al,80h dx,cw dx,al

al,1 cx,8

dx,portc dx,al delay al,1 putar ulang

delay proc near push cx mov cx,02fffh loop $ pop cx ret delay endp ORG 20F0H DB 0EAH DW 0100H DW 0FDF0H CODE_SEG ENDS END START

Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

b. Untuk percobaan less. 1, lengkapi tabel-tabel tersebut. No. Data LED yang menyala 1 1 L1 2 2 L2 3 4 L3 4 8 L4 5 16 L5 6 32 L6 7 64 L7 8 128 L8 No. 1 2 3 4 5 6 7 8 Data 5 7 10 15 21 31 42 87 LED yang menyala L3, L1 L3, L2, L1 L4, L2 L4, L3, L2, L1 L5, L3, L1 L5, L4, L3, L2, L1 L6, L4, L2 L7, L5, L3, L2, L1

c. Buat program untuk mengatur gerakan LED dari port A dari kanan ke kiri. CODE_SEG SEGMENT ASSUME CS:CODE_SEG,DS:CODE_SEG,SS:CODE_SEG ORG 100H start: jmp mulai porta portb portc cw equ 00h equ 01h equ 02h equ 03h

mulai: mov mov out ulang: mov mov putar: mov out call shr loop jmp

al,80h dx,cw dx,al

al,128 cx,8

dx,porta dx,al delay al,1 putar ulang

Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

delay proc near push cx mov cx,02fffh loop $ pop cx ret delay endp ORG 20F0H DB 0EAH DW 0100H DW 0FDF0H CODE_SEG ENDS END START Dan, jalankan apa yang anda lihat ! Lampu LED berjalan dari kanan ke kiri c. Pada percobaan SIPO dan PIPO, lengkapi tabel percobaan! Tabel SIPO. e 0 1 0 1 1 1 0 1 0 1 Tabel PIPO. Data g 01111110b 01111101b 01111011b 01110111b 01101111b 01011111b 00111111b 1 1 1 1 1 0 1 f 1 1 1 0 1 1 1 e 1 1 1 1 1 1 0 g 1 1 0 0 0 0 0 1 0 0 d 0 1 0 0 1 0 0 1 0 0 DATA KE f 0 1 1 1 0 0 0 1 0 0 Display c 0 0 1 0 0 0 0 0 0 0 b 0 0 0 0 0 1 1 0 0 0 a 0 1 0 0 1 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9

Segment d 1 1 1 1 0 1 1 c 1 0 1 1 1 1 1 b 0 1 1 1 1 1 1 a 1 1 0 1 1 1 1

Display

Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

e 0 1 0 1 1 1 0 1 0 1

g 1 1 0 0 0 0 0 1 0 0

d 0 1 0 0 1 0 0 1 0 0

DATA KE f 0 1 1 1 0 0 0 1 0 0

Display a 0 1 0 0 1 0 0 0 0 0 c 0 0 1 0 0 0 0 0 0 0 b 0 0 0 0 0 1 1 0 0 0 0 1 2 3 4 5 6 7 8 9

a. Buatlah Display tampilan nama mahasiswa masing-masing beserta NIM pada LCD. CODE_SEG SEGMENT ASSUME CS:CODE_SEG,DS:CODE_SEG,ES:CODE_SEG,SS:CODE_SEG ORG 100H start: jmp mulai DISPCLR EQU 00000001B FUNCSET EQU 00111000B ENTRMOD EQU 00000110B DISPON EQU 00001100B pa equ 00h pb equ 01h pc equ 02h cw equ 03h awal db ? data db ? akhir db ? mulai: Mov AX, CS Mov DS, AX Xor AX, AX Mov ES, AX Mov SS, AX Lea SI, Awal Lea CX, Akhir Mov DI, SI Sub CX, SI Cld Rep Movsb Mov SP,2000h Xor AX,AX
Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

Mov DS,AX mov dx,cw mov al,82h out dx,al call init_LCD mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call data,80h control_out data_49h data_out data,81h control_out data_4Ch data_out data,82h control_out data_48h data_out data,83h control_out data_41h data_out data_84h control_out data,4Dh data_out data,0c0h control_out data_32h data_out data,0c1h control_out data_30h data_out data,0c2h control_out data_30h data_out

mov data,0c3h call control_out mov data_39h


Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

call data_out mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call mov call lagi: jmp lagi data,0c4h control_out data_2Dh data_out data,0c5h control_out data_31h data_out data,0c6h control_out data_31h data_out data,0c7h control_out data_2Dh data_out data,0c8h control_out data_31h data_out data,0c9h control_out data_31h data_out data,0cah control_out data_36h data_out

init_LCD proc near mov data,DISPCLR call control_out call delay mov call call mov call call data,FUNCSET control_out delay data,ENTRMOD control_out delay
Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

mov data,DISPON call control_out call delay ret init_LCD endp control_out proc near mov dx,pa mov al,00000000b out dx,al call delay mov mov out call mov mov out call dx,pa al,10000000b dx,al delay dx,pc al,data dx,al delay

mov dx,pa mov al,00000000b out dx,al call delay ret control_out endp data_out proc near mov dx,pa mov al,01000000b out dx,al call delay mov mov out call mov mov out call dx,pa al,11000000b dx,al delay dx,pc al,data dx,al delay

mov dx,pa mov al,01000000b out dx,al call delay ret data_out endp
Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

delay proc near push cx mov cx,0fffh loop $ pop cx ret delay endp ORG DB DW DW 20F0H 0EAH 0100H 0FDF0H

CODE_SEG ENDS END START

2. Percobaan motor DC dan Stepper


a. Buatlah aplikasi program motor dan stepper beserta hasil outputnya Motor DC: CODE_SEG SEGMENT ASSUME CS:CODE_SEG,DS:CODE_SEG,SS:CODE_SEG ORG 100H start: jmp mulai porta portb portc cw pa2 pb2 pc2 cw2 equ 00h equ 01h equ 02h equ 03h equ 304h equ 305h equ 306h equ 307h

mulai: mov al,80h mov dx,cw out dx,al mov al,10001001b mov dx,cw2 out dx,al putar: mov dx,portc mov al,0 out dx,al
Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

jmp putar ORG 20F0H DB 0EAH DW 0100H DW 0FDF0H CODE_SEG ENDS END START

Motor Stepper CODE_SEG SEGMENT ASSUME CS:CODE_SEG,DS:CODE_SEG,SS:CODE_SEG ORG 100H start: jmp mulai porta portb portc cw pa2 pb2 pc2 cw2 equ 00h equ 01h equ 02h equ 03h equ 304h equ 305h equ 306h equ 307h

mulai: mov al,80h mov dx,cw out dx,al mov al,10001001b mov dx,cw2 out dx,al putar: mov dx,porta mov al,1 out dx,al call delay mov dx,porta mov al,2 out dx,al call delay mov dx,porta mov al,4 out dx,al
Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

call delay mov dx,porta mov al,8 out dx,al call delay jmp putar delay proc near push cx mov cx,02fffh loop $ pop cx ret delay endp ORG 20F0H DB 0EAH DW 0100H DW 0FDF0H CODE_SEG ENDS END START c. Lengkapi tabel-tabel pada percobaan modul praktikum. Motor DC: Data Kecepatan 0 Pelan 64 Agak Cepat 128 Lumayan Cepat 192 Cepat 255 Sangat Cepat Arah 0 0 0 Arah 3 3 3 Data 0 100 250 Data 0 100 250 Arah Gerakan Motor Melawan Arah Jarum Jam Melawan Arah Jarum Jam Melawan Arah Jarum Jam Arah Gerakan Motor Searah Jarum Jam Searah Jarum Jam Searah Jarum Jam

Arah Putaran Melawan Arah Jarum Jam Melawan Arah Jarum Jam Melawan Arah Jarum Jam Melawan Arah Jarum Jam Melawan Arah Jarum Jam Kecepatan motor Pelan Cepat Sangat Cepat Kecepatan motor Pelan Cepat Sangat Cepat

Motor Stepper Kemanakah arah pergerakan motor stepper? Searah jarum jam. Gantilah delay, dan amati pergerakannya. Semakin besar delay, semakin lambat gerakan stepper. Semakin kecil delay, semakin cepat gerakan steppernya

Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

Praktikum Mikroprosesor

ILHAM RAHMAT KURNIA 2009 - 11 - 116

Praktikum Mikroprosesor

Potrebbero piacerti anche