当前位置:网站首页>Liquid crystal display
Liquid crystal display
2022-07-03 09:56:00 【Yi 761】
#include<reg52.h>
#define DB P0
sbit RS=P2^6;
sbit RW=P2^5;
sbit E=P2^7;
void chushi();
void lcdshow(unsigned char x,unsigned char y,unsigned char *str);
void xiezhiling(unsigned char cmd);
void main()
{
unsigned char str[]="I LOVE U";
chushi();// initial
lcdshow(4,0,str);
lcdshow(1,1,"hello chengdu");
while(1);
}
void chushi()
{
xiezhiling(0x38);
xiezhiling(0x0C);//0000 1DCB D=1 Turn on the display ;D=0 Turn off the display ;C=1 Show cursor ;C=0 Close the cursor ;B=1 The cursor blinks ;B=0 The cursor does not flash
xiezhiling(0x06);//0000 01NS N=1 Pointer plus one ;N=0 Pointer minus one ;S=1,N=1 Move left ;S=1,N=0 Move right ;S=0 Don't move
xiezhiling(0x01);// All pointers are clear 0
}
void jiance()
{
unsigned char sta;
DB=0xFF;// Keep yourself high before reading
RS=0;
RW=1;
do{
E=1;
sta=DB;
E=0;
}while(sta & 0x80);// Check whether the highest bit is 0
}
void xiezhiling(unsigned char cmd)// Write instructions
{
jiance();
RS=0;
RW=0;
E=1;
DB=cmd;
E=0;
}
void lcdwrdat(unsigned char dat)// Writing data
{
jiance();
RS=1;
RW=0;
E=1;
DB=dat;
E=0;
}
void lcdc(unsigned char x,unsigned char y)// Regard LCD as x and y Axis
{
unsigned char addr;
if(y==0)// When y Shaft for 0 when
addr=0x00+x;// first line 00 To 0F
else
addr=0x40+x;// The second line 40 To 4F
xiezhiling(addr|0x80);
}
void lcdshow(unsigned char x,unsigned char y,unsigned char *str)
{
lcdc(x,y);
while(*str!='\0')// Not equal to space
{
lcdwrdat(*str++);// First value at ++,* and ++ The same level is preferred
}
}
边栏推荐
- STM32 interrupt switch
- Development of electrical fire system
- Stm32f04 clock configuration
- Vector processor 9_ Basic multilevel interconnection network
- CEF download, compile project
- Oracle database SQL statement execution plan, statement tracking and optimization instance
- 自动装箱与拆箱了解吗?原理是什么?
- Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
- There is no specific definition of embedded system
- 我想各位朋友都应该知道学习的基本规律就是:从易到难
猜你喜欢

When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
![[male nanny style] teach you to open the first wechat applet](/img/a1/a571609ee846adf75506a88a629906.png)
[male nanny style] teach you to open the first wechat applet

You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~

干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己

Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode

Which language should I choose to program for single chip microcomputer

Code word in NR
![[CSDN] C1 training problem analysis_ Part II_ Web Foundation](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[CSDN] C1 training problem analysis_ Part II_ Web Foundation

单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇

UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
随机推荐
[22 graduation season] I'm a graduate yo~
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
Stm32-hal library learning, using cubemx to generate program framework
Definition and use of enum in C language
STM32 serial communication principle
Electronic product design, MCU development, circuit cloning
2020-08-23
顺利毕业[3]-博客系统 更新中。。。
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
Interruption system of 51 single chip microcomputer
Development of electrical fire system
Chromium Embedded Framework (CEF) 介绍
Code word in NR
Stm32f407 key interrupt
Windows下MySQL的安装和删除
[CSDN]C1训练题解析_第二部分_Web基础
学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
NR PUCCH format0 sequence generation and detection mechanism
01仿B站项目业务架构
Gpiof6, 7, 8 configuration