Assembly code for LCD - Liquid Crystal Display
Sample code for LCD - Liquid Crystal Display
Following code can be using for 8051 and 8052 ICs like: 89c51, 89c52, 89s51, 89s52, 89c2051.
;========================================================== ; Pin Definations ;========================================================== lcddatabus equ 80h ;LCD Data Bus P0 lcdrs equ a7h ;RS P2.7 lcden equ a6h ;EN P2.6 ;========================================================== ; Main Program starts from here ;========================================================== start call lcdinit mov dptr,#msgwelcome call lcddisp back jmp back ;========================================================== ; Sub routines starts from here ;========================================================== lcdinit mov lcddatabus,#38h call lcdcmd mov lcddatabus,#38h call lcdcmd mov lcddatabus,#38h call lcdcmd mov lcddatabus,#38h call lcdcmd mov lcddatabus,#0ch call lcdcmd mov lcddatabus,#01h call lcdcmd mov lcddatabus,#06h call lcdcmd ret ;========================================================== lcdcmd clr lcdrs setb lcden nop nop clr lcden call lcddelay ret ;========================================================== lcddata setb lcdrs setb lcden nop nop clr lcden call lcddelay ret ;========================================================== lcddelay mov delreg1,#10 ;LCD lcddelay1 mov delreg2,#250 djnz delreg2,$ djnz delreg1,lcddelay1 ret ;========================================================== lcddisp mov lcddatabus,#01h call lcdcmd mov 39h,#00h lcddisp2 mov a,39h movc a,@a+dptr cjne a,#'@',lcddisp1 mov lcddatabus,#c0h call lcdcmd inc 39h jmp lcddisp2 lcddisp1 cjne a,#'$',lcddisp3 call pc_int ret lcddisp3 mov lcddatabus,a call lcddata inc 39h jmp lcddisp2 ;========================================================== ; Messages to be displayed on LCD ;========================================================== msgwelcome db " WELCOME TO @INTERFACING PROG$" ;===================================================== ; Program ENDS here ;=====================================================
Highlights
-
List of Projects
Navigate through wide range of projects of 8051. Applications including ADC, DAC, LCD, Matrix LEDs, Keypad, Stepper Motor, DC motor, EEPROM, Relay, Timer, Sensors, RTC and much more.
Pick and Place Robot Temperature & Light Controller Rolling Display Matrix LEDs Person Counter & Password Detector Home Security System Data Logger Greenhouse monitor & control Flow computer Electronic Voting Machine Pick & Place Robot Temperature & Light Controller Rolling Display Matrix LEDs Person Counter & Password Detector Data Logger Home Security System Greenhouse monitor & control Flow computer
Read More