LCD Display

Let’s display a character on the 20×4 LCD.

Circuit Diagram: The schematic diagram interface into the MCU is my choice based on the availability of free MCU port, see my definition below.  The interface mode is the 4-bit mode, where only 4 connections of the data bus interfaced into the MCU.

 

 

Displaying Location: When you display a character in the LCD,  you will need to specify the location as row and column.  This is 20 x 4 LCD, means,  20 characters can be displayed on the column including space, and there are 4 rows, you can display total 80 characters.

 

Program:

'******************************************************************
'Lerning 8051 core MCU
'by F. Dandy
'1diyshare.com
'******************************************************************

' Program Name : Display on the 20x4 LCD

'Declaration

'NAMING Port
LCD_Backlight Alias P2.3
Red_LED1      Alias P3.6

'CONFIGURATION For the LCD
Config Lcd = 20 * 4
Config Lcdpin = Pin , Db4 = P2.4 , Db5 = P2.5 , Db6 = P2.6 , Db7 = P2.7
Config Lcdpin = Pin , E = P2.0 , Rs = P2.1

'LCD Initialization
   Lcdinit
   Cursor Off
   Display On

LCD_Backlight = 0

ClS
   Locate 1,1 : Lcd "-Welcome to BAGUIO-"
   Locate 2,1 : Lcd " the City of Pines "

   Locate 4,1 : Lcd " Diyos ti Kumuyog "

Do
   Red_LED1 = 0
   Waitms 200
   Red_LED1 = 1
   Waitms 200
Loop

End

 

Program Simulation: I am sure you know how to compile and simulate the program already, if not, click it here