|

8051 / 8052 / 89s51 / 89s52 LCD interfacing using Look-up tables

Interfacing LCD with 89s52 / 89c52 / 8051 / 8052
The following program has been tested for 8051 LCD interfacing with microcontroller . This program send characters on LCD using Look Up Table technique. You may refer to this program for educational use only. And may refer to the owner of this program in case of any difficulty at mohd_ahmed89@hotmail.com.


;OBJECTIVE:


;THIS PROGRAM DISPLAY ('25','1','40','9') ON LCD BY USING LOOK-UP TABLE TECHNIQUE
;PROGRAMER:     JAMAL
;PROGRAM NAME:  LCD DISPLAY NUMBERS USING LOOK-UP TABLE TECHNIQUE 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_TABLE


HERE:SJMP HERE
;*******************************************************************************************

SEND_TABLE:    LCALL INITLCD
        mov     dptr,#LOOKUPTABLE
        MOV     A,#00000010B
          MOVC    A,@A+DPTR
          MOV     nam,A
        SETB     rs
        CLR     RW
        setb     en
        clr     en
             lcall     waitlcd
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

LOOKUPTABLE:     DB '25','1','40','9'

;************************************************************************************************


end

Posted by Unknown on 14:47. 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