1.RANGKAIAN SIMULASI [kembali]
Rangkaian Aplikasi LCD dengan Mikroprosessor 8086 |
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG,DS:CODE_SEG,ES:CODE_SEG,SS:CODE_SEG
ORG 100H ;program mulai origin 100h
start: jmp mulai
porta equ 300h ;port a ppi
portb equ 301h ;port b ppi
portc equ 302h ;port c ppi
ctrlword equ 303h ;port cw ppi
DISPCLR EQU 00000001B
FUNCSET EQU 00111000B
ENTRMOD EQU 00000110B
DISPON EQU 00001100B
CURSOR EQU 00001110B
BLINK EQU 00001101B
Mulai:
mov al,10000000b ;init ppi
mov dx,CtrlWord ;pada 80H mode = 0
out dx,al ;port a = output
;port b = output
;port c lower = output
;port c upper = output
call init_LCD
lagi:
mov al,80h
call control_out
mov al,30h
call data_out
mov al,0C0h
call control_out
mov al,31h
call data_out
jmp lagi
init_LCD proc near
mov al,DISPCLR
call control_out
mov al,FUNCSET
call control_out
mov al,ENTRMOD
call control_outmov al,DISPON
call control_out
mov al,CURSOR
call control_out
ret
init_LCD endp
; PA7 : E
; PA6 : RS
control_out proc near
mov dx,portc
out dx,al
call delay
mov dx,porta
mov al,00000000b
out dx,al
call delay
mov dx,porta
mov al,10000000b
out dx,al
call delay
mov dx,porta
mov al,00000000b
out dx,al
call delay
ret
control_out endp
data_out proc near
mov dx,portc
out dx,al
call delay
mov dx,porta
mov al,01000000b
out dx,al
call delay
mov dx,porta
mov al,11000000b
out dx,al
call delay
mov dx,porta
mov al,01000000b
out dx,al
call delayret
data_out endp
delay proc near ; Procedure delay
push cx ; simpan cx
mov cx,0ffffh ; isi cx dengan lama delay
loop $ ; loopng sampai cx=0
pop cx ; keluarkan cx
ret
ASSUME CS:CODE_SEG,DS:CODE_SEG,ES:CODE_SEG,SS:CODE_SEG
ORG 100H ;program mulai origin 100h
start: jmp mulai
porta equ 300h ;port a ppi
portb equ 301h ;port b ppi
portc equ 302h ;port c ppi
ctrlword equ 303h ;port cw ppi
DISPCLR EQU 00000001B
FUNCSET EQU 00111000B
ENTRMOD EQU 00000110B
DISPON EQU 00001100B
CURSOR EQU 00001110B
BLINK EQU 00001101B
Mulai:
mov al,10000000b ;init ppi
mov dx,CtrlWord ;pada 80H mode = 0
out dx,al ;port a = output
;port b = output
;port c lower = output
;port c upper = output
call init_LCD
lagi:
mov al,80h
call control_out
mov al,30h
call data_out
mov al,0C0h
call control_out
mov al,31h
call data_out
jmp lagi
init_LCD proc near
mov al,DISPCLR
call control_out
mov al,FUNCSET
call control_out
mov al,ENTRMOD
call control_outmov al,DISPON
call control_out
mov al,CURSOR
call control_out
ret
init_LCD endp
; PA7 : E
; PA6 : RS
control_out proc near
mov dx,portc
out dx,al
call delay
mov dx,porta
mov al,00000000b
out dx,al
call delay
mov dx,porta
mov al,10000000b
out dx,al
call delay
mov dx,porta
mov al,00000000b
out dx,al
call delay
ret
control_out endp
data_out proc near
mov dx,portc
out dx,al
call delay
mov dx,porta
mov al,01000000b
out dx,al
call delay
mov dx,porta
mov al,11000000b
out dx,al
call delay
mov dx,porta
mov al,01000000b
out dx,al
call delayret
data_out endp
delay proc near ; Procedure delay
push cx ; simpan cx
mov cx,0ffffh ; isi cx dengan lama delay
loop $ ; loopng sampai cx=0
pop cx ; keluarkan cx
ret
Jika video diatas tidak bisa diputar, maka klik :
Tidak ada komentar:
Posting Komentar