📄 液晶显示屏.c
字号:
#include<AT89X51.H>
#include<INTRINS.H>
sbit RS=P0^0;
sbit RW=P0^1;
sbit E=P0^2;
sbit PSB=P0^3;
sbit RST=P0^4;
sbit b=P1^7; //忙标志位
unsigned char c;
unsigned char a[]= {0xa2,0xd9,0xa2,0xda,0xbe,0xa7};
busy()
{
P1=0xff;
RS=0;
RW=1;
E=1;
while(b==1);
E=0;
}
SEND_I(unsigned char A)
{
busy();
RS=0;
RW=0;
P1=A;
E=1;
_nop_();
_nop_();
E=0;
}
SEND_D(unsigned char A)
{
busy();
RS=1;
RW=0 ;
P1=A;
E=1;
_nop_();
_nop_();
E=0;
}
READ_D(unsigned char A)
{
busy();
RS=1;
RW=1;
E=1;
_nop_();
A=P1;
_nop_();
E=0;
}
void Print(unsigned char *str)
{
while(*str!='\0')
{
SEND_D(*str);
str++;
}
}
chushi()
{
RST=1;
PSB=1;
SEND_I(0x34);
SEND_I(0x30);
SEND_I(0x01);
SEND_I(0x06);
SEND_I(0x0c);
}
main()
{
chushi();
SEND_I(0x80);
Print("液晶显示屏液晶显示屏");
Print("显示程序");
Print("~!@#$%^&*()_+|{}");
while(a[c]!=0)
{
SEND_D(a[c]);
c++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -