Lab#08
Interfacing LCD to 8051 Microcontroller
Lab#08
Interfacing LCD to 8051 Microcontroller
Understanding LCD (pins)
❖ Enable (Latch data) ❖ RW=0 for Write
❖ High to Low edge is needed to ❖ RW=1 for Read
latch data (write)
❖ Low to high edge (Read) ❖ Register Select (RS)
❖ Rs=0 Command register selected
❖ Rs=1 Data register selected
❖ 8 data pins (DB0-DB7)
❖ Bi-directional
❖ Data and Command
❖ Alphanumeric
Characters are send in
ASCII format
❖ Vo= Contrast control Pin
Understanding LCD (inside)
01) Registers
❖Two 8-bit registers
❖Instruction Register (IR) and Data Register (DR)
❖These register can be selected by Register Select (RS) pin of LCD
Understanding LCD (inside)
02) Display Data RAM (DDRAM)
❖ Stores data to be display, represented in 8-bit character codes
❖ Capacity is 80 character (bytes)
❖ DDRAM Address layout of a 2x16 LCD
Line 1
Line 2
03) Character Generator RAM (CGRAM)
Understanding LCD (inside)
04)Busy Flag (BF)
❖When BF=1 Lcd is in internal operation mode and can’t accept next instruction
❖It is output to DB7 pin
❖When RS=0 and RW=1 Read busy flag
❖The next instruction must be written after insuring that BF=0
❖See manual page#55
LCD’s internal control accept several commands and modify the display
accordingly.
❖Must write RET at the end of each subroutine
❖Lcall and Scall
❖Jb bit, label (instruction)
again:
jb p1.7,again if p1.7=1 it will jump to label.