📄 lcd1602.c
字号:
#include "reg52.h"
#include "lcd1602.h"
/*void checkbusy(void)
{lcd=0xff;
enable=0;
rw=1;
rs=0;
enable=1;
delay(100);
while(lcd&busy);
enable=0;
}*/
/************延时函数*/
void Delay(uint i)
{
while(i--);
}
/*写指令函数*/
void Write_Instruction(uchar x)
{
Delay(1000);
E=0;
RW=0;
RS=0;
LCDData=x; //接收数据
E=1;
Delay(20);
E=0;
}
/*写单个数据的函数*/
void Write_Data(uchar x)
{
Delay(1000);
E=0;
RW=0;
RS=1;
E=1;
LCDData=x;
E=0;
}
/*初始化函数*/
void InitLCD(void)
{Write_Instruction(0x38);
Delay(200);
//Write_Instruction(0x0e);
Write_Instruction(0x0c);
Delay(200);
Write_Instruction(0x06);
Delay(200);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -