Before you interface an LCD with any microcontroller , say 8051 or AVR, you should have a knowledge of basic LCD commands. These commands or codes are used to get the LCD perform some particular task, for example, clearing the LCD display screen ornshifting entire data to the right etc. I have gathered here some the commands that might prove for you an important data, because once I was doing 8051 LCD interfacing it really helped me a lot. Here are some of it :-
01H : Clear Display Screen
02H : Return Home
04H: Decrement Cursor
06H : Increment Cursor
05H : Shift Dis[;ay Right
07H : Shift Display Left
08H : Display off, Cursor off
AH : Display off, Cursor on
CH : Display on, Cursor off
EH : Display on, Cursor Blinking
FH : Display on, Cursor Blinkinf
10H: Shift Cursor position to left
14H: Shift Cursor position to right
18H: Shift the entire display to left
1CH: Shift the entire display to right
80H: Force cursor to begin from the Ist line
C0H:Force cursor to begin from the 2nd line
38H: 2 lines and 5 x 7 matrix
More to folow for 8051 LCD interfacing
15:49 |
Posted in
LCD command codes,
Microcontroller
|
Read More »
Assembly Code for Sending String to LCD using microcontroller 89c52 / 89s52
Hello guys, this is a working code for sending string to 8051 LCD interfaced. You may use this with AVR microcontrollers with little amendments. In case of any difficulty just write down in comments and you will get the answer within 24 hrs. 8051 LCD interfacing requires perquisite knowledge of microcontrollers and LCD pin description. This 8051 lcd code has been tested recently and adapted in heat monitoring sysytem.
;THIS PROGRAM DISPLAY STRING "JAMAL EL-640-07" ON LCD
;PROGRAMER: JAMAL
;SEMESTER: 5EL(A)
;PROGRAM NAME: LCD DISPLAY STRING ON LCD
;MICROCONTROLLER: ATMEL AT89S52
;*****************************************************************************************
org 00H
rs equ P1.5
rw equ P1.6
en equ P1.7
nam equ P3
OUTPUT_ADC EQU P2
STR_PTR EQU 35H
;*******************************************************************************************
CLR EN
LCALL SEND_STRING
HERE:SJMP HERE
;*******************************************************************************************
SEND_STRING: lcall initlcd
mov dptr,#string
MOV STR_PTR,#0FFH
STRING_ROUTINE:
INC STR_PTR
MOV A,STR_PTR
MOVC A,@A+DPTR
CJNE A,#'$',DISP_AGN
JMP EXIT_LCD_MSG
DISP_AGN: mov nam,a
setb rs
CLR RW
setb en
clr en
lcall waitlcd
JMP STRING_ROUTINE
EXIT_LCD_MSG:
RET
;*********************************************************************************************
waitlcd: mov nam,#0FFh
clr en
clr rs
setb rw
setb en
mov a,nam
jb acc.7,waitlcd
clr en
ret
;*********************************************************************************************
initlcd: MOV R0,#04H
MOV nam,#38H
INIT_LCD1: CALL WR_LCD_COMMAND
DJNZ R0,INIT_LCD1
lcall waitlcd
mov nam,#0Eh
CALL WR_LCD_COMMAND
lcall waitlcd
mov nam,#01h
CALL WR_LCD_COMMAND
lcall waitlcd
mov nam,#0C0h
CALL WR_LCD_COMMAND
lcall waitlcd
ret
;************************************************************************************************
writetext: mov nam,a
setb rs
CLR RW
setb en
clr en
lcall waitlcd
ret
;************************************************************************************************
WR_LCD_COMMAND: CLR rs
CLR rw
SETB en
CLR en
RET
;************************************************************************************************
org 100h
STRING: DB 'JAMAL EL-640-07$'
;************************************************************************************************
end
09:35 |
Posted in
LCD command codes,
Microcontroller
|
Read More »