lcd1602.c
来自「驱动ADUC845进行AD采样」· C语言 代码 · 共 65 行
C
65 行
#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 Cls(void)
{
Write_Instruction(0x01);
}
/*写入一串字符串函数*/
void Write_String(uchar x,uchar *p)
{ Write_Instruction(x);
while(*p!=0x00)
{Write_Data(*p);
p++;
if (x++==0x8f)
{Write_Instruction(0xc0);}
}
}
/*初始化函数*/
void InitLCD(void)
{Write_Instruction(0x38);
Delay(200);
Write_Instruction(0x0e);
Delay(200);
Write_Instruction(0x06);
Delay(200);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?