8051 interfacing with LCD display in proteus

8051 interfacing with LCD display in proteus

8051 interfacing with LCD display, Proteus simulation
8051 interfacing with LCD display circuit diagram

8051 interfacing with LCD display in proteus

In this article we will learn how to Interface 8051 with LCD display in proteus.

In the last post we will learn how to Interface Arduino TC74 sensor with Alphanumeric LCD circuit in proteus. You can visit our website,
I hope you appreciate my work, let’s discuss about today’s project.

 

 

 

Components:

  1. IC (80C51)
  2. IC (74LS373)
  3. NAND 2
  4. LCD display (LM032L)
  5. Crystal (1.2/MHz)
  6. Capacitor (33p)
  7. Jumper wires

Construction…

  • Connect pin 9 of 8051 with +ve
  • Connect pin 18 of 8051 with one side of capacitor 33p through the one side of crystal
  • Connect 2nd side of capacitor with one side of 2nd capacitor and then connect them with GND
  • Connect the pin 19 of 8051 with 2nd side of crystal through the 2nd side of 2nd capacitor
  • Connect pin 16 of 8051 with one terminal of NAND
  • Connect pin 17 of 8051 with 2nd terminal of NAND
  • Connect signal pin of NAND with E pin of LCD display
  • Connect VSS pin of LCD display with GND
  • Connect VDD pin of LCD display with +ve
  • Connect RS pin of LCD display with pin 2 of IC (74L)
  • Connect RW pin of LCD display with pin 5 of IC (74L)
  • Connect pin 3 of IC (74L) with D0 pin of LCD display
  • Connect pin 4 of IC (74L) with D1 pin of LCD display
  • Connect pin 7 of IC (74L) with D2 pin of LCD display
  • Connect pin 8 of IC (74L) with D3 pin of LCD display
  • Connect pin 13 of IC (74L) with D4 pin of LCD display
  • Connect pin 14 of IC (74L) with D5 pin of LCD display
  • Connect pin 17 of IC (74L) with D6 pin of LCD display
  • Connect pin 18 of IC (74L) with D7 pin of LCD display
  • Connect pin 11 of IC (74L) with the pin 30 of 8051
  • Connect pin 1 of IC (74L) with GND
8051 interfacing with LCD display, Proteus simulation
8051 interfacing with LCD display circuit diagram
8051 interfacing with LCD display, Proteus simulation
8051 interfacing with LCD display circuit diagram

Working…

Interfacing an 8051 microcontroller with an LCD (Liquid Crystal Display) is a common task in embedded systems and microcontroller-based projects. The 8051 microcontroller communicates with the LCD to display characters, numbers, and other information on the screen.

Applications…

  1. Digital Thermometer
  2. Weather Station
  3. Home Automation
  4. Digital Clock
  5. Attendance System

Advantages…

  1. Low Power Consumption
  2. Simplicity
  3. Cost-Effective
  4. Compatibility
  5. Real-Time Feedback

Program code…

[dt_code]

#include <bitdef.h>
#include <io80C51BH.h>
;LCD Registers addresses
LCD_CMD_WR equ 0
LCD_DATA_WR equ 1
LCD_BUSY_RD equ 2
LCD_DATA_RD equ 3
;LCD Commands
LCD_CLS equ 1
LCD_HOME equ 2
LCD_SETMODE equ 4
LCD_SETVISIBLE equ 8
LCD_SHIFT equ 16
LCD_SETFUNCTION equ 32
LCD_SETCGADDR equ 64
LCD_SETDDADDR equ 128
;Reset vector
org 0000h
jmp start
;Start of the program
org 0100h
string1a:db ‘ !! A M A Z I N G !! ‘
db 0
string1b:db ‘!! A M A Z I N G !! ‘
db 0
string2:db ‘ A virtual LM032L… ‘
db 0
string3:db ‘ driven by a virtual ‘
db 0
string4:db ‘   8051 processor!’
db 0
start: mov A,#038h
call wrcmd
loop: mov A,#LCD_SETVISIBLE+6 ;Make the display & blink visible:
call wrcmd
mov R7,#2
loop2:
mov DPTR,#string1a
call wrstr
  mov DPTR,#200
  call wtms
mov A,#LCD_CLS;Clear screen
call wrcmd
mov DPTR,#string1b
call wrstr
  mov DPTR,#200
  call wtms
mov A,#LCD_CLS;Clear screen
call wrcmd
djnz R7,loop2
mov DPTR,#string1a
call wrstr
  mov DPTR,#400
  call wtms
mov A,#LCD_SETDDADDR+64
call wrcmd
mov DPTR,#string2
call wrslow
  mov DPTR,#200
  call wtms
mov A,#LCD_CLS;Clear screen
call wrcmd
mov DPTR,#string3
call wrslow
        mov A,#LCD_SETDDADDR+64
call wrcmd
mov DPTR,#string4
call wrslow
mov A,#LCD_SETVISIBLE+7;Show the blink cursor as well.
call wrcmd
  mov DPTR,#2000
  call wtms
mov A,#LCD_CLS;Clear screen
call wrcmd
jmp loop
;Sub routine to write null terminated string at DPTR in program ram.
wrstr: mov R0,#LCD_DATA_WR
wrstr1: clr A
movc A,@A+DPTR
jz wrstr2
movx @R0,A
call wtbusy
inc DPTR
push DPL
push DPH
pop DPH
pop DPL
jmp wrstr1
wrstr2: ret
;Sub routine to write null terminated string at DPTR in program ram. Slowly
wrslow: mov R0,#LCD_DATA_WR
wrslw1: clr A
movc A,@A+DPTR
jz wrslw2
movx @R0,A
call wtbusy
inc DPTR
push DPL
push DPH
        mov DPTR,#100
        call wtms
pop DPH
pop DPL
jmp wrslw1
wrslw2: ret
;Sub routine to write command:
wrcmd: mov R0,#LCD_CMD_WR
movx @R0,A
jmp wtbusy
;Sub routine to write character:
wrchar: mov R0,#LCD_DATA_WR
movx @R0,A
;Subroutine to wait for busy clear
wtbusy: mov R1,#LCD_BUSY_RD
movx A,@r1
jb ACC.7,wtbusy
ret
;Wait for number of seconds in A
wtsec: push ACC
call wtms
pop ACC
dec A
jnz wtsec
ret
;Wait for number of milliseconds in DPTR
wtms:   xrl DPL,#0FFh ;Can’t do DEC DPTR, so do the loop by forming 2’s complement
xrl DPH,#0FFh;and incrementing instead.
inc DPTR
wtms1: mov TL0,#09Ch ;100 ticks before overflow = 1ms at 1.2MHz Clock
mov TH0,#0FFh
mov TMOD,#1;Timer 0 mode 1
setb TCON.4;Timer 0 runs
wtms2:jnb TCON.5,wtms2
clr TCON.4;Timer 0 stops
clr TCON.5
inc DPTR
mov A,DPL
orl A,DPH
jnz wtms1
ret

[/dt_code]