Kamis, 08 Januari 2015
PROGRAM LCD NAMA NIM ANIMASI GESER KANAN KE KIRI AT8951
; PROGRAM LCD MENAMPILKAN NAMA N NIM ANIMASI GESER KANAN KE KIRI
; CREATED BY A.MUHAMMAD REZKY SULFAJRI
;
geserL equ 00011011b ; 0 0 0 1 S/C R/L X X
geserR equ 00011111b ; 0 0 0 1 S/C R/L X X
org 0h
call init_LCD
start: call write_char1
call write_char2
call geser
sjmp start
;
geser:
mov R6,#40 ;R7 = 40; geser sebanyak 40 karakter
lagi: mov R1,#geserL ;R1 = Geser Left
call write_inst
call Ldelay
djnz R6,lagi ;R7=R7-1, jika R7 ? 0 maka lompat ke lagi
write_char1:
mov dptr,#word1 ;DPTR = [ address word1 ]
mov r3,#16 ;R3=16,number character to be display
mov r1,#80h ;R1=80h,address DDRAM start position
call write_inst
;
write1:clr a ; A = 0
movc a,@a+dptr ; A = [A+ DPTR]
mov r1,A ; R1 = A
inc dptr ; DPTR = DPTR +1
call write_data;
djnz r3,write1 ; R3 = R3-1,
ret
;
write_char2:
mov dptr,#word2 ;DPTR = [ address word1 ]
mov r3,#16 ;R3=16,number character to be display
mov r1,#0C0h ;R1=0C0h,address DDRAM start position
call write_inst
;
write2:clr a ; A = 0
movc a,@a+dptr ; A = [A+ DPTR]
mov r1,A ; R1 = A
inc dptr ; DPTR = DPTR +1
call write_data;
djnz r3,write2 ; R3 = R3-1,
ret
Init_lcd:
mov r1,#00000001b ;Display clear
call write_inst ;
mov r1,#00111000b ;Function set,Data 8 bit,2 line font 5x7
call write_inst ;
mov r1,#00001100b ;Display on,cursor off,cursor blink off
call write_inst ;
mov r1,#00000110b ;Entry mode, Set increment
call write_inst
ret
;
Write_inst:
clr P3.6 ; RS = P2.0 = 0, write mode instruction
mov P0,R1 ; D7 s/d D0 = P0 = R1
setb P3.7 ; EN = 1 = P2.1
call delay ; call delay time
clr P3.7 ; EN = 0 = P2.1
ret
;
Write_data:
setb P3.6 ; RS = P2.0 = 1, write mode data
mov P0,R1 ; D7 s/d D0 = P0 = R1
setb P3.7 ; EN = 1 = P2.1
call delay ; call delay time
clr p3.7 ; EN = 0 = P2.1
ret
;
Ldelay: mov R2,#010h
Ld1: acall delay
djnz R2,Ld1
ret
delay: mov R0,#0
delay1: mov R7,#35H
djnz R7,$
djnz R0,delay1
ret
;
word1: DB 'A.REZKY SULFAJRI' ; here is the data to be look up
;
word2: DB ' NIM : 13.010 ';
end
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar