📄 lcd_display.h
字号:
#define uchar unsigned char
#define uint unsigned int
#define DA_LCDPORT P0 //LCD
sbit busy=P0^7;
sbit RS=P1^5;
sbit RW=P1^6;
sbit E=P1^7;
void Delay(uchar t, uchar i)
{ for(;t>0;t--)
{ for(;i>0;i--); }
}
void lcdbusy()
{ RS=0;
RW=1;
busy=1;
while(1)
{ E=1;
if(!busy) break;
E=0;
}
}
void Lcd_WD(uchar da)
{ lcdbusy();
RS=1;
RW=0;
E=1;
DA_LCDPORT=da;
//Delay(1,100);
E=0;
}
void Lcd_WC(uchar c)
{ lcdbusy();
RS=0;
RW=0;
E=1;
DA_LCDPORT=c;
//Delay(1,100);
E=0;
}
void Lcd_Init()
{ //Delay(15,125);
Lcd_WC(0x38);
//Delay(5,125);
Lcd_WC(0x38);
//Delay(5,125);
Lcd_WC(0x38);
//Delay(5,125);
Lcd_WC(0x08);
Lcd_WC(0x01);
Lcd_WC(0x06);
Lcd_WC(0x0c);
}
void Lcd_WS(uchar *s,uchar x,uchar y)//字符串由N个单字字符组成
{ for(;*s!=0;s++)
{ Lcd_WC(0x80+(x++)+0x40*y);//地址
Lcd_WD(*s); //数据
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -