1602 LCD Command Introduction

Publisher:幸福的家园Latest update time:2016-12-24 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Similar to the usage of MCU registers, when using 1602 LCD, we must first perform initial function configuration. There are several instructions for 1602 LCD that need to be understood.

1)
Write instruction 0x38 to set the display mode, set 16x2 display, 5x7 dot matrix, 8-bit data interface. This instruction is fixed for our LCD, and 0x38 must be written. If you look carefully, you will find that our LCD actually has an internal dot matrix of 5x8. Some 1602 LCDs are also compatible with serial communication, which can be done with 2 IO ports, but the speed is slow. Our LCD is fixed to 0x38 mode.

2) Display on/off and cursor setting instructions
There are 2 instructions here. The first instruction has 8 bits in a byte, of which the upper 5 bits are fixed to 0b00001, and the lower 3 bits are represented by DCB from high to low. D=1 means display on, D=0 means display off; C=1 means display cursor, C=0 means no display cursor; B=1 means cursor blinking, B=0 means cursor not blinking.

The second instruction has 6 upper bits fixed to 0b000001, and the lower 2 bits are represented by NS from high to low. N=1 means that after reading or writing a character, the pointer automatically increases by 1 and the cursor automatically increases by 1. N=0 means that after reading or writing a character, the pointer automatically decreases by 1 and the cursor automatically decreases by 1. S=1 means that after writing a character, the entire screen display moves left (N=1) or right (N=0) to achieve the effect of the cursor not moving but the screen moving, just like the effect of our calculator input, and S=0 means that after writing a character, the entire screen display does not move.

3) The clear screen instruction
is fixed. Writing 0x01 means clearing the screen, which includes clearing the data pointer and all displays. Writing 0x02 means only clearing the data pointer, but not the display.

4) RAM address setting instruction
The highest bit of the instruction code is 1, and the lower 7 bits are the RAM address. The relationship between the RAM address and the characters on the LCD is shown in Figure 12-2 above. Usually, we have to set the address before reading and writing data, and then perform data reading and writing operations.

Reference address:1602 LCD Command Introduction

Previous article:Introduction to the read and write timing of 1602 LCD
Next article:MCU communication timing analysis

Recommended ReadingLatest update time:2024-11-16 14:31

Design of LCD1602 driver based on S3C2440
Development target platform: linux -2.6.28+S3C2440+CRAMFS/YAFFS2   Development environment: UBUNTU-9.04+ arm - linux -gcc-3.4.1   This time we need to develop a simple character LCD driver on s3c2440, the details are as follows:   LCD1602 has a total of 16 pins, 3 control signals RS, RW, RE, and 8 data lines DB0~DB7,
[Microcontroller]
Homemade 51 MCU common header files (LCD1602)
/*-------------------------------------------------------------------------- LCD1602.H The user function is C51. Copyright (c) 1988-2004 Keil Elektronik GmbH sum zhaojun All rights reserved. --------------------------------------------------------------------------*/ #ifndef __LCD1602_H__ #define __LCD1602_H__
[Microcontroller]
LPC2138+LCD1602 counter proteus simulation and source code adding comments and changing pins
The schematic diagram of the LPC2138 simulation simple calculator is as follows (the proteus simulation project file can be downloaded from the attachment of this post) The lcd1602 liquid crystal display   LPC2138 source program is as follows: #define IN_TARGET #include "config.h" #define LED1 1 18 // P0.18 control
[Microcontroller]
LPC2138+LCD1602 counter proteus simulation and source code adding comments and changing pins
C51 Programming 20-Application (LCD1602 Display-1)
Looking back at the previous programming tutorials, the first one is the I/O chapter. I/O mainly explains the pin characteristics of I/O and how to control the level input and output of I/O through C51; the second one is the interrupt chapter. The interrupt chapter introduces the necessity of the interrupt system and
[Microcontroller]
C51 Programming 20-Application (LCD1602 Display-1)
PIC16 MCU LCD1602 Driver PIC16F877A PIC16F887
/* LCD display related */ #define DATA 1 /* LCD writes data to 1 */ #define COM 0 /* LCD write command is 0 */ #define LINE1 0b10000000 #define LINE2 0b11000000 #define LCD_E RD6 #define LCD_RW RD5 #define LCD_RS RD4 void LCD_WRITE_4( unsigned char R1, unsigned char FLAG ); void LCD_WRITE( unsigned char R1
[Microcontroller]
PIC16 MCU LCD1602 Driver PIC16F877A PIC16F887
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号