INTERFACING LCD DISPLAY USING 8051
Objectives of the Lab
 Learning pin configurations of 8051
 Learning important commands for LCD
 Learning subroutines for displaying command and data
 Displaying specific data on LCD.
Deciding Pins or Ports to use
Use with
caution
If EA high
*As LCD needs
11 pins, we will
use P2 and P3.
LCD
 Keypads are usually used
for displaying messages.
 There are 2 lines and
each line can display 16
characters. That’s why it
is called 16x2 line
display.
 It is widely used in
applications that use
MENU or display values.
 It is a good alternative
for SSDs.
Pin Configuration
Important Commands
1.
2. on
3.
4.
Instructions used in this Lab
 SETB Px.y
 CLR Px.y
 NOP
 See instruction set for the details of above commands.
LCD Timing for Read
LCD Read Subroutine (BF check)
 LCD read is only needed to check busy flag, to check if LCD is
busy. Busy flag is D7. If it is set, the LCD is busy
1. RS=0
2. R/ 𝑊=1
3. E=0 => E=1
4. Stay here if bf=1.
There is a passive way to send command or data without
checking the BF of LCD. If delay greater than 200 nanoseconds
is between the commands or data for LCD, there is no need for
BF.
LCD Timing for Write
LCD Write subroutine
 LCD write is used for writing command and/or data to
LCD.
1. Move data in A to port where Data pins of LCD are
connected.
2. RS=0 for command, RS=1 for data.
3. R/ 𝑊=0
4. E=1 => E=0
5. Check BF or give delay.
Pin naming and data display
 Instead of calling pins by their ports, we can also give custom
names to pins and use it during code e.g.
rs bit p3.5 => setb rs; this means setb p3.5
rw bit p3.6 and en bit p3.7.
 This is done below ‘org 00h’ and above the rest of the code.
For port, mydata equ P2 (pin 2.0 to D0 and so on…)
 To display character use mov a,#‘X’.
 To display integer, first make it ASCII, add a,30h.
 To display a line, use look-up table.
line1: db “HELLO WORLD”,0
 Soon, we will see the need to append 0 at the end of line.
Subroutine for Writing
Command/Data
Label
Clear/Set
RS
Call Delay
setb en
nop
clr en
Move
command/
data to P2
H to L
pulse to
enable
ret
Using Lookup Table for display
 The display of character array is simple, the difficult task is to end
that display. For this, we keep a zero at the end of the line and check
if the data is zero.
mov dptr,#line1
again:
mov a,#0
movc a,@a+dptr
inc dptr
jz exit1; jump if accumulator is zero
call data_wrt; subroutine to display single character
jmp again
exit1:
line1: db “Hello World”,0
Semi-final Pseudo-Code
 What we have to do to display overall data on LCD is
following
1. Define pin and port names
2. Initialize LCD by sending (38h,0Eh,01h followed by
command write subroutine)
3. Then data of line1 using lookup table (use data write
subroutine)
4. Then data of line2 using lookup table (use data write
subroutine)
5. Command Write Subroutine and Data Write Subroutine
6. Delay Subroutine
Final Pseudo-Code
 The above Pseudo code works during software test but during
hardware we need to add some more steps before step 2.
 We need to send 030h, commands 3 times with a delay of 50
milli-seconds to initialize the hardware LCD which during
software is not needed.
Proteus Devices needed in this Lab
1. AT89c51
2. 16x2 LCD
Lab Tasks
 Display Workstation#XY on line1 and ID numbers on line
2.
 Quiz Next Week of Keypad and Stepper Motor.
 Individual Project Briefing during Experiment.

More Related Content

PPT
PPTX
LCD Interacing with 8051
PPTX
8051 io interface
DOCX
Lcd interfacing
PPTX
Lcd interfacing with microprocessor 8051
PPTX
Switches and LEDs interface to the 8051 microcontroller
PPTX
LCD interfacing
PPT
Lcd & keypad
LCD Interacing with 8051
8051 io interface
Lcd interfacing
Lcd interfacing with microprocessor 8051
Switches and LEDs interface to the 8051 microcontroller
LCD interfacing
Lcd & keypad

What's hot (20)

PPTX
An application of 8085 register interfacing with LCD
PPTX
Serial Communication in 8051
PPTX
8051 microcontroller
PPT
8255_utkarsh_kulshrestha
PPT
Interfacing 8255
PPTX
Interfacing with peripherals: analog to digital converters and digital to ana...
PPT
Adc interfacing
DOCX
Arm7 Interfacing examples
PDF
Lpc2148 i2c
PPTX
Hardware View of Intel 8051
PPTX
An Ultra-Low Power Asynchronous-Logic
PPTX
Ppt on interfacing led and 7 segment with 8951
DOC
Unit iv microcontrollers final
PPT
Interfacing ics for microprocessor
PDF
Serial1
PPTX
8255 PPI
PPTX
IC 8253 - Microprocessor
PPTX
Operation of 8255A
An application of 8085 register interfacing with LCD
Serial Communication in 8051
8051 microcontroller
8255_utkarsh_kulshrestha
Interfacing 8255
Interfacing with peripherals: analog to digital converters and digital to ana...
Adc interfacing
Arm7 Interfacing examples
Lpc2148 i2c
Hardware View of Intel 8051
An Ultra-Low Power Asynchronous-Logic
Ppt on interfacing led and 7 segment with 8951
Unit iv microcontrollers final
Interfacing ics for microprocessor
Serial1
8255 PPI
IC 8253 - Microprocessor
Operation of 8255A
Ad

Similar to Micro c lab6(lcd) (20)

PPTX
131080111003 mci
PPT
Lcd interfacing1
PDF
Experiment 16 x2 parallel lcd
PPT
Lcd interface with atmega32 avr best.ppt
PDF
Lecture mp 7(interface)
DOCX
Alp lcd
PDF
Interfacing with LCD
PDF
08_lcd.pdf
PPTX
LCD_Example.pptx
PPTX
Lcd interfaing using 8051 and assambly language programming
DOCX
For this phase of the course project, you will research a bank to .docx
PDF
Microcontroller part 4
PPTX
Basic of Firmware & Embedded Software Programming in C
PPTX
8051_interface_LCD.pptx iii ece III ECE MPMC jntu k syllabus this is very he...
PDF
2022-BEKM 3453 - LCD and keypad.pdf
DOCX
Est 8 1 st
PPTX
UNIT 5 Interfacing and Mixed Signal Controller.pptx
PPTX
Applications of microcontroller(8051)
PDF
Microcontroladores: El microcontrolador 8051 con LCD 16x2
PDF
Program LCD ARM
131080111003 mci
Lcd interfacing1
Experiment 16 x2 parallel lcd
Lcd interface with atmega32 avr best.ppt
Lecture mp 7(interface)
Alp lcd
Interfacing with LCD
08_lcd.pdf
LCD_Example.pptx
Lcd interfaing using 8051 and assambly language programming
For this phase of the course project, you will research a bank to .docx
Microcontroller part 4
Basic of Firmware & Embedded Software Programming in C
8051_interface_LCD.pptx iii ece III ECE MPMC jntu k syllabus this is very he...
2022-BEKM 3453 - LCD and keypad.pdf
Est 8 1 st
UNIT 5 Interfacing and Mixed Signal Controller.pptx
Applications of microcontroller(8051)
Microcontroladores: El microcontrolador 8051 con LCD 16x2
Program LCD ARM
Ad

More from Mashood (12)

PPTX
Patience (1).pptx
PPTX
Micro c lab8(serial communication)
PPTX
Micro c lab7(timers)
PPTX
Micro c lab5(stepper-motor)
PPTX
Micro c lab4(keypad)
PPTX
Micro c lab3(ssd)
PPTX
Micro c lab2(led patterns)
PPTX
Micro c lab1(intro to 8051)
PPT
Amplifiers (analog electronics ii lab)
PDF
Pcb design using proteus
PPT
Function Generator
PPT
Speed Measuring Circuit
Patience (1).pptx
Micro c lab8(serial communication)
Micro c lab7(timers)
Micro c lab5(stepper-motor)
Micro c lab4(keypad)
Micro c lab3(ssd)
Micro c lab2(led patterns)
Micro c lab1(intro to 8051)
Amplifiers (analog electronics ii lab)
Pcb design using proteus
Function Generator
Speed Measuring Circuit

Recently uploaded (20)

PDF
MA in English at Shiv Nadar University – Advanced Literature, Language & Rese...
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
Module on health assessment of CHN. pptx
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PDF
Compact First Student's Book Cambridge Official
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PDF
English-bài kiểm tra tiếng anh cơ bản.pdf
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
Literature_Review_methods_ BRACU_MKT426 course material
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PDF
CRP102_SAGALASSOS_Final_Projects_2025.pdf
PPTX
What’s under the hood: Parsing standardized learning content for AI
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PDF
International_Financial_Reporting_Standa.pdf
PDF
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PPT
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
MA in English at Shiv Nadar University – Advanced Literature, Language & Rese...
Journal of Dental Science - UDMY (2021).pdf
Nurlina - Urban Planner Portfolio (english ver)
Everyday Spelling and Grammar by Kathi Wyldeck
Environmental Education MCQ BD2EE - Share Source.pdf
Module on health assessment of CHN. pptx
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
Compact First Student's Book Cambridge Official
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
English-bài kiểm tra tiếng anh cơ bản.pdf
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Literature_Review_methods_ BRACU_MKT426 course material
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
CRP102_SAGALASSOS_Final_Projects_2025.pdf
What’s under the hood: Parsing standardized learning content for AI
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
International_Financial_Reporting_Standa.pdf
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt

Micro c lab6(lcd)

  • 2. Objectives of the Lab  Learning pin configurations of 8051  Learning important commands for LCD  Learning subroutines for displaying command and data  Displaying specific data on LCD.
  • 3. Deciding Pins or Ports to use Use with caution If EA high *As LCD needs 11 pins, we will use P2 and P3.
  • 4. LCD  Keypads are usually used for displaying messages.  There are 2 lines and each line can display 16 characters. That’s why it is called 16x2 line display.  It is widely used in applications that use MENU or display values.  It is a good alternative for SSDs.
  • 7. Instructions used in this Lab  SETB Px.y  CLR Px.y  NOP  See instruction set for the details of above commands.
  • 9. LCD Read Subroutine (BF check)  LCD read is only needed to check busy flag, to check if LCD is busy. Busy flag is D7. If it is set, the LCD is busy 1. RS=0 2. R/ 𝑊=1 3. E=0 => E=1 4. Stay here if bf=1. There is a passive way to send command or data without checking the BF of LCD. If delay greater than 200 nanoseconds is between the commands or data for LCD, there is no need for BF.
  • 10. LCD Timing for Write
  • 11. LCD Write subroutine  LCD write is used for writing command and/or data to LCD. 1. Move data in A to port where Data pins of LCD are connected. 2. RS=0 for command, RS=1 for data. 3. R/ 𝑊=0 4. E=1 => E=0 5. Check BF or give delay.
  • 12. Pin naming and data display  Instead of calling pins by their ports, we can also give custom names to pins and use it during code e.g. rs bit p3.5 => setb rs; this means setb p3.5 rw bit p3.6 and en bit p3.7.  This is done below ‘org 00h’ and above the rest of the code. For port, mydata equ P2 (pin 2.0 to D0 and so on…)  To display character use mov a,#‘X’.  To display integer, first make it ASCII, add a,30h.  To display a line, use look-up table. line1: db “HELLO WORLD”,0  Soon, we will see the need to append 0 at the end of line.
  • 13. Subroutine for Writing Command/Data Label Clear/Set RS Call Delay setb en nop clr en Move command/ data to P2 H to L pulse to enable ret
  • 14. Using Lookup Table for display  The display of character array is simple, the difficult task is to end that display. For this, we keep a zero at the end of the line and check if the data is zero. mov dptr,#line1 again: mov a,#0 movc a,@a+dptr inc dptr jz exit1; jump if accumulator is zero call data_wrt; subroutine to display single character jmp again exit1: line1: db “Hello World”,0
  • 15. Semi-final Pseudo-Code  What we have to do to display overall data on LCD is following 1. Define pin and port names 2. Initialize LCD by sending (38h,0Eh,01h followed by command write subroutine) 3. Then data of line1 using lookup table (use data write subroutine) 4. Then data of line2 using lookup table (use data write subroutine) 5. Command Write Subroutine and Data Write Subroutine 6. Delay Subroutine
  • 16. Final Pseudo-Code  The above Pseudo code works during software test but during hardware we need to add some more steps before step 2.  We need to send 030h, commands 3 times with a delay of 50 milli-seconds to initialize the hardware LCD which during software is not needed.
  • 17. Proteus Devices needed in this Lab 1. AT89c51 2. 16x2 LCD
  • 18. Lab Tasks  Display Workstation#XY on line1 and ID numbers on line 2.  Quiz Next Week of Keypad and Stepper Motor.  Individual Project Briefing during Experiment.