RESPONSI
MICROPOSESOR
NAMA : ALIF
MAULANA
NIM : 11.11.2571
KELAS : TI 11 E
TULIS NAMA
DAN NIM KARAKTER PADA LCD KARAKTER
Ketik program berikut ini untuk menulis nama : ALIF MAULANA
& 11.11.2571
$mod51
org 0h
CLR P3.5
call
init_LCD
start: mov R1,#80h ; Lokasi Display RAM, Row=1 Col=1
call
write_inst
mov R1,#'A'
call
write_data
mov R1,#'L'
call
write_data
mov R1,#'I'
call
write_data
mov R1,#'F'
call write_data
mov R1,#' '
call
write_data
mov R1,#'M'
call
write_data
mov R1,#'A'
call
write_data
mov R1,#'U'
call
write_data
mov R1,#'L'
call
write_data
mov R1,#' A'
call
write_data
mov R1,#'N'
call
write_data
mov R1,#'A'
call
write_data
mov
R1,#0C0h ; Lokasi Display RAM, Row=2 Col=2
call
write_inst
mov R1,#'1'
call
write_data
mov R1,#'1'
call
write_data
mov R1,#'.'
call
write_data
mov R1,#'1'
call
write_data
mov R1,#'1'
call
write_data
mov R1,#'.'
call
write_data
mov R1,#'2'
call
write_data
mov R1,#'5'
call
write_data
mov R1,#'7'
call
write_data
mov R1,#'1'
call
write_data
stop: sjmp
stop
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 ;
P3.6 = RS =0
mov P0,R1 ;
P0 = D7 s/d D0 = R1
setb P3.7 ;
P3.7 =EN = 1
call delay
; call delay time
clr P3.7 ;
P3.7 =EN = 0
ret
;
Write_data:
setb P3.6 ;
P3.6 = RS =1
mov P0,R1 ;
P0 = D7 s/d D0 = R1
setb P3.7 ;
P3.7 =EN = 1
call delay
; call delay time
clr p3.7 ;
P3.7 =EN = 0
ret
;
delay: mov R0,#0
delay1:mov R7,#0fh
djnz R7,$
djnz
R0,delay1
ret
;
End
Hasil :
output
Tidak ada komentar:
Posting Komentar