PRAKTEK
MIKROPROSESOR
TULISAN BERGESER PADA
LCD
Nama : JANUAR SUDIONO
NIM : 11.11.2375
Kelas : TI 11 A
Alamat Blog : http://mesoed-januarserdadumuda.blogspot.com/
HASIL
PRINTSCREEN PROGRAM LCD :
CODING PROGRAM :
$mod51
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
000h
clr
p3.5
call
init_LCD
start:
call write_char
;call
init_LCD
call
write_char2
call
geser
sjmp
start
;
geser:
mov
R6,#40 ;R7 = 40; geser sebanyak 40 karakter
lagi:
mov R1,#geserR ;R1 = GeserRight
call
write_inst
call
ldelay
djnz
R6,lagi ;R7=R7-1, jika R7 ? 0 maka lompat ke lagi
write_char:
mov
dptr,#word1 ;DPTR = [ address word1 ]
mov
r3,#33 ;R3=33,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,#29 ;R3=29,number character to be display
mov
r1,#0C0h ;R1=80h,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,#040h
Ld1:
acall delay
djnz
R2,Ld1
ret
delay:
mov R0,#0
delay1:
mov R7,#0fh
djnz
R7,$
djnz
R0,delay1
ret
;
word1:
DB ' JANUAR SUDIONO'; here
is the data to be look up
word2:
DB ' 11.11.2375'; here
is the data to be look up
;
end
Tidak ada komentar:
Posting Komentar