|

8051 LCD interfacing for sending string

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

Posted by Unknown on 09:35. Filed under , . You can follow any responses to this entry through the RSS 2.0. Feel free to leave a response

Labels

Recently Commented

Recently Added