Patrick Fitzgerald
Published © GPL3+

8051 Assembly Code Demo for HD47780 LCD Display

MCS51 assembly code to print on LCD display. Demo program and simulation on MCU8051IDE Interactive Design Environment for 8051 chips.

IntermediateProtip2 hours251

Things used in this project

Software apps and online services

mcu8051ide Interactive Design Suite for 8051 development

Story

Read more

Code

LCD.asm

Assembly x86
LED demo file from MCU8051IDE
MCS51 assembly code to print ascii string to HD47780 screen
; Very basic demonstration example for HD44780 simulator
; * Click on "Virtual HW" in the main menu,
; * choose "Open",
; * change filter to VH Component,
; * open "LCD.vhc",
; * press F2,
; * press F6,
; * enjoy ... :-)
; * press F2 to end.
;
; Note: simulated delays are skipped in this example.
;
	org	0
	jmp	start

RS	bit	P3.0
RW	bit	P3.1
E	bit	P3.2
D	equ	P1

cmd	macro	cmd_code
	setb	E
	mov	D, cmd_code
	clr	E
endm

string:	db	'Welcome to MCU 8051 IDE!\0'

start:	mov	D, #0
	clr	RW
	mov	DPTR, #string

main:	clr	RS
	cmd	#00000001b	; Clear display
	cmd	#00000010b	; Cursor home
	cmd	#00000110b	; Entry mode set
	cmd	#00001111b	; Display ON/OFF control
	cmd	#00011110b	; Cursor/display shift
	cmd	#00111100b	; Function set
	cmd	#10000001b	; Set DDRAM address

	; Print the string ...
	setb	RS
	mov	R0, #0
print:	mov	A, R0
	inc	R0
	movc	A, @A+DPTR
	cmd	A
	cjne	A, #0, print
	sjmp	main

	end

LCD.vhc

Plain text
Virtual Hardware Component for MCU8051IDE
parameters used for simulated HD47780 LCD display
needs to be named LCD.vhc
# MCU 8051 IDE: Virtual HW configuration file
# Project: Demo project

LcdHD44780 {2 24 633x172+515+234 {0 3 4 1 8 1 1 3 5 1 9 1 10 1 2 3 6 1 3 1 7 1} {0 7 4 1 8 5 1 6 5 2 9 6 10 7 2 5 6 3 3 0 7 4} {} 1 1 0 0 0 1 1x1+0+0 withdrawn {0 {}} {0 {}} 1}

Credits

Patrick Fitzgerald
124 projects • 45 followers
Contact

Comments

Please log in or sign up to comment.