51 MCU drives 1602 LCD assembly language program

Publisher:小牛队Latest update time:2015-06-19 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
LCMRS EQU P2.4
LCMRW EQU P2.5
LCMEN EQU P2.6
LCMDATA EQU P0

ORG 0000H
LJMP MAIN
ORG 0030H

MAIN:
MOV SP,#60H
LCALL LCMSET
LCALL LCMCLR
MOV A,#80H
LCALL LCMWR0
MOV DPTR,#TAB0
LCALL LCMWR2
MOV A,#0C0H
LCALL LCMWR0
MOV DPTR,#TAB1
LCALL LCMWR2
SJMP$

TAB0: DB "I AM YUAN MING",00H
TAB1: DB "NICE TO MEET YOU",00H

LCMLAY: ; Read busy program, used to determine whether d7 is 0
PUSH ACC
LOOP:
CLR LCMEN
CLR LCMRS
SETB LCMRW
SETB LCMEN
MOV A,LCMDATA
CLR LCMEN
JB ACC.7,LOOP
POP ACC
LCALL DELAY
RIGHT


LCMWR0: ;Write instruction
LCALL LCMLAY
CLR LCMEN
CLR LCMRS
CLR LCMRW
SETB LCMEN
MOV LCMDATA,A
CLR LCMEN
RIGHT

LCMWR1: ;Write data
LCALL LCMLAY
CLR LCMEN
SETB LCMRS
CLR LCMRW
SETB LCMEN
MOV LCMDATA,A
CLR LCMEN
RIGHT

LCMWR2: Write string (string belongs to data)
PUSH ACC
RUN1:
CLR A
MOVC A,@A+DPTR
JZ LOOP2
LCALL LCMWR1
INC DPTR
LJMP LOOP1
LOOP2:
POP ACC
RIGHT

LCMSET: ; Program initialization
MOV A,#38H
LCALL LCMWR0
MOV A,#08H
LCALL LCMWR0
MOV A,#01H
LCALL LCMWR0
MOV A,#06H
LCALL LCMWR0
MOV A,#0CH
LCALL LCMWR0
RIGHT

LCMCLR: ; Qingping
MOV A,#01H
LCALL LCMWR0
RIGHT


DELAY:
MOV R6,#5 ;2.7MS delay subroutine (function unknown)
D1:  MOV R7,#248
DJNZ R7,$
DJNZ R6,D1
RIGHT


END
Reference address:51 MCU drives 1602 LCD assembly language program

Previous article:8051 MCU operation K9KF5608 FLASH memory program
Next article:51 MCU drives ADC0809 C language program

Recommended ReadingLatest update time:2024-11-16 13:45

Photoelectric switch counting based on 51 single chip microcomputer
The circuit schematic is as follows: Design requirements (1) Using the photoelectric switch counting system, the count value can be set arbitrarily from 0 to 999. When the set value is exceeded, the stepper motor stops. During counting, the stepper motor rotates at a constant speed. (2) When the set value is exceede
[Microcontroller]
Photoelectric switch counting based on 51 single chip microcomputer
Delay program of 12M crystal oscillator of 51 single chip microcomputer
These are the parameters I have adjusted slowly. Errors are inevitable, unless assembly is used, it will be accurate. I will update and modify them later to make them as accurate as possible. Debugging environment: Keil V4.02 The source code is as follows: #include reg52.h #include intrins.h //--Delay 0.2*n(ms
[Microcontroller]
Design of human-computer interaction system based on 51 single-chip microcomputer and FPGA
In the development of modern instruments, human-computer interaction functions are playing an irreplaceable role. Instruments with user-friendly human-computer interaction interfaces will be easier to operate and use, thereby improving work efficiency. Liquid crystal displays (LCDs) have the characteristics of low p
[Microcontroller]
Design of human-computer interaction system based on 51 single-chip microcomputer and FPGA
51 MCU serial communication driver
#include reg52.h #include "./delay/delay.h" #include stdio.h    unsigned char temp ; void uart_init() { SCON = 0x50; //Set uart working mode   TMOD |= 0x20; //Set the timer working mode: Mode 2   TH1 = 0xfd; //Set the baud rate to 9600   TR1 = 1; // Enable timer interrupt   }   void uart_send_byte(unsigned char
[Microcontroller]
Implementation and design of interface circuit and program for liquid crystal display based on microcontroller C8051F020
In the design of single-chip computer systems, the design of the LCM (liquid crystal display module) human-computer interaction interface is often a very important link. LCM can be used to display setting parameters, status prompts, test results, and parameters to be input on smart instruments. This article combines t
[Microcontroller]
Implementation and design of interface circuit and program for liquid crystal display based on microcontroller C8051F020
Digital trigger controlled by 51 single chip microcomputer
The research content of power electronics technology includes three aspects: power electronic devices, conversion circuits and control circuits. Power electronic conversion technology has a wide range of applications in the field of industrialization. Phase-controlled rectification technology has been used in househ
[Microcontroller]
Digital trigger controlled by 51 single chip microcomputer
51 MCU interrupt learning
1. The concept of interruption       When the CPU is processing an event A, another event B occurs, requiring the CPU to process it quickly (interrupt occurs);       the CPU temporarily interrupts the current work and switches to process event B (interrupt response and interrupt service);       after the CPU finishe
[Microcontroller]
51 MCU interrupt learning
Analysis of I/O port driving capability of several commonly used 51 single-chip microcomputers
In the control system, the I/O port of the microcontroller is often used to drive other circuits . The driving capacity of several commonly used microcontroller I/O ports is stated in the relevant data: the P1 and P3 lines of GMS97C2051 and AT89C2051 have an output drivin
[Analog Electronics]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号