Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Try Panji Abdurachman

2017-11-102
LCD

CODE_SEG SEGMENT

ASSUME CS:CODE_SEG,DS:CODE_SEG,SS:CODE_SEG

ORG 100H

start: jmp mulai

DISPCLR EQU 00000001B

FUNCSET EQU 00111000B

ENTRMOD EQU 00000110B

DISPON EQU 00001111B

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

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
Mov DI,SI

Sub CX,SI

Cld

Rep Movsb

Mov SP,2000h

Xor AX,AX

Mov DS,AX

mov dx,cw

mov al,82h

out dx,al

call init_LCD

mov data,86h

call control_out

mov data,41h

call data_out

mov data,87h

call control_out

mov data,50h

call data_out

mov data,88h

call control_out

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
mov data,52h

call data_out

mov data,89h

call control_out

mov data,49h

call data_out

mov data,8Ah

call control_out

mov data,4Ch

call data_out

mov data,0c5h

call control_out

mov data,21h

call data_out

mov data,0c6h

call control_out

mov data,30h

call data_out

mov data,0c7h

call control_out

mov data,31h

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
call data_out

mov data,0c8h

call control_out

mov data,37h

call data_out

mov data,0c9h

call control_out

mov data,2Dh

call data_out

mov data,0c9h

call control_out

mov data,31h

call data_out

mov data,0c9h

call control_out

mov data,31h

call data_out

mov data,0c9h

call control_out

mov data,2Dh

call data_out

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102

mov data,0c9h

call control_out

mov data,31h

call data_out

mov data,0c9h

call control_out

mov data,30h

call data_out

mov data,0c9h

call control_out

mov data,30h

call data_out

lagi:

jmp lagi

init_LCD proc near

mov data,DISPCLR

call control_out

call delay

mov data,FUNCSET

call control_out

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
call delay

mov data,ENTRMOD

call control_out

call delay

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

mov dx,pa

mov al,10000000b

out dx,al

mov dx,pc

mov al,data

out dx,al

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102

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

mov dx,pa

mov al,11000000b

out dx,al

mov dx,pc

mov al,data

out dx,al

mov dx,pa

mov al,01000000b

out dx,al

call delay

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
ret

data_out endp

delay proc near

push cx

mov dx,0fffh

loop $

pop cx

ret

delay endp

ORG 20F0H

DB 0EAH

DW 0100H

DW 0FDF0H

CODE_SEG ENDS

END START

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
MOTOR DC

CODE_SEG SEGMENT

ASSUME CS:CODE_SEG,DS:CODE_SEG,SS:CODE_SEG

ORG 100H

start: jmp mulai

porta equ 00h

portb equ 01h

portc equ 02h

cw equ 03h

awal db ?

data db ?

arah 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

mov DS,AX

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102

mov al,80h

mov dx,cw

out dx,al

mov data,80

mov arah,0

mov al,data

mov dx,portc

out dx,al

mov dx,portb

mov al,arah

out dx,al

putar:

jmp putar

ORG 20F0H

DB 0EAH

DW 0100H

DW 0FDF0H

CODE_SEG ENDS

END START

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
Motor stepper

CODE_SEG SEGMENT

ASSUME CS:CODE_SEG,DS:CODE_SEG,SS:CODE_SEG

ORG 100H

start: jmp mulai

porta equ 00h

portb equ 01h

portc equ 02h

cw equ 03h

mulai:

mov al,80H

mov dx,cw

out dx,al

putar:

mov al,12

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

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
mov dx,porta

out dx,al

call delay

mov al,7

mov dx,porta

out dx,al

call delay

mov al,7

mov dx,porta

out dx,al

call delay

mov al,7

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,0fffh

loop $

pop cx

ret

Laboratorium Mikroprosesor
STT – PLN
Try Panji Abdurachman
2017-11-102
delay endp

ORG 20F0H

DB 0EAH

DW 0100H

DW 0FDF0H

CODE_SEG ENDS

END START

Laboratorium Mikroprosesor
STT – PLN

You might also like