1602 LCD display C language programming

Publisher:快乐旅途Latest update time:2016-01-12 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
First of all, I would like to state that this program was not written by me. It is a program in Guo Tianxiang's 51 video tutorial. I used it when I started learning about microcontrollers. It is completely feasible.

#include
#define uchar unsigned char
#define uint unsigned int
sbit lcden=P3^7;
sbit led=P3^6;
sbit lcdrs=P3^5;
uchar num;
uchar code table[]="I LIKE MCU!";                                         

void delay(uint i)  
{
uchar j;
for(;i>0;i--)
for(j=110;j>0;j--);
}

void write_1602com(uchar com)      
{
lcdrs=0;
P0=com;              //数据口
delay(5);
lcden=1;
delay(5);
lcden=0;
}

void write_1602(uchar date)    
{
lcdrs=1;
P0=date;            //数据口
delay(5);
lcden=1;
delay(5);
lcden=0;
}

void init_1602()             
{
lcden=0;
write_1602com(0x38);
write_1602com(0x0e);
write_1602com(0x06);
write_1602com(0x01);
write_1602com(0x80+0x10);
}

void main()
{
init_1602();
for(num=0;num<11;num++)
{
   write_1602(table[num]);
   delay(20);
}
while(1);
}

Reference address:1602 LCD display C language programming

Previous article:msp430 lcd screen 1602 driver
Next article:Flowing Light-Timer Delay

Recommended ReadingLatest update time:2024-11-17 10:37

51 single chip microcomputer uses timer and 1602 LCD to realize a timer
1. Platform: Windows 10 64-bit Education Edition 2. Tools: HC6800-ES V2.0 of Puzhong Technology, Keil uVision 2 3. Note: Chip STC89C52, 8-bit 1602 LCD display 4. Achievement effect: After power on, 1602 starts to display timing. Press the first button to enter the setting, press the second button to set the position
[Microcontroller]
51 single chip microcomputer uses timer and 1602 LCD to realize a timer
51 MCU drives LCD1602 circuit diagram + program
If the formatting is messy on the web page, you can download the complete source code of this example from here :  http://www.51hei.com/f/1602430.rar  The above picture is a simulation effect showing 2 lines of characters. #include AT89x51.h #define uchar unsigned char /***************************************
[Microcontroller]
51 MCU drives LCD1602 circuit diagram + program
51 MCU_1602 LCD custom heart-shaped pattern
# include unsigned char table1 ={0x03,0x07,0x0f,0x1f,0x1f,0x1f,0x1f,0x1f,                          0x18,0x1E,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, 0x07,0x1f                          ,0x1f,0x1f,0x1f,0x1f ,0x1f,0x1f,                          0x10,0x18,0x1c,0x1E,0x1E,0x1E,0x1E,0x1E, 0x0f                          ,0x07,0x03
[Microcontroller]
1602 LCD display module C language program (8-bit)
SMC1602A (16*2) analog port wiring method Connection diagram:               ---------------------------------------------------               |LCM-----51      | LCM-----51      | LCM-----51            |               --------------------------------------------------|               |DB0-----P1.0 | DB4-----P1.4 | R
[Microcontroller]
51 MCU serial communication 1602 display
Introduction: This article is about 51 single chip microcomputer serial communication 1602 display. /*----------------------------------------------- Name: LCD1602 forum: write: Date: 2009.5 Modification: None Content: Static display of characters through standard programs The pin definitions are as follows: 1-VSS 2
[Microcontroller]
Some experience about 1602 LCD
I started reviewing LCD today! Oh my god! It feels like I'm learning it all over again. I've forgotten a lot of things. It seems that I need to practice very hard to be proficient in it. You won't remember what you learn in a short time with temporary efforts! Not to mention being proficient in application! Let me t
[Microcontroller]
LCD1602 driver based on m128 (8 lines/4 lines)
//************************************************* // File name: 1602.h // Function: AVR LCD1602 4/8 line driver // Author: seabisuit // Last modified: June 22, 2011 // Description: Use GCC programming, 1602 provides 4/8 line drivers // Line 4 is temporarily high by 4 bits //******************************************
[Microcontroller]
51 MCU drives 1602 LCD display c program
/* Program effect: The single-chip microcomputer controls the LCD display 1602 to display letters and numbers, and the user can change the io program copyright: http://www.51hei.com */ #include //header file #define uchar unsigned char //macro definition #define uint unsigned int uchar code table ="51HEI
[Microcontroller]
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号