• 大小: 2.7MB
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2023-10-02
  • 语言: 其他
  • 标签: LCD  

资源简介

LCD任意显示,数字字母,或显示一串自己想要的文字,lcd选用12864、1602

资源截图

代码片段和文件信息

#include
#include
#define uchar unsigned char
#define uint  unsigned int
#define  LCD_date P0
sbit LCD_RS=P2^6;
sbit LCD_RW=P2^5;
sbit LCD_EN=P2^7;
uchar code lin1[]=“ 1 2 3 4 5 6 8 9“;
uchar code lin2[]=“ 1 2 3 4 5 6 8 9“;
uchar code lin3[]=“ 1 2 3 4 5 6 8 9“;
uchar code lin4[]=“ 1 2 3 4 5 6 8 9“;
void LCD_Delay1ms(uchar c);
void Check_BY(void);
void LcdInit();
void Lcdwritecom(uchar com);
void Lcdwritedate(uchar dat);
void LCD_Delay1ms(uchar c)
{uchar ab;
for( ;c>0;c--)
for(  b=130;b>0;b--)
for(a=38;a>0;a--);
}
void LcdInit()
{
Lcdwritecom(0x30);
Lcdwritecom(0x30);
Lcdwritecom(0x30);
Lcdwritecom(0x38);
Lcdwritecom(0x08);
LCD_Delay1ms(10);
Lcdwritecom(0x01);
LCD_Delay1ms(10);
Lcdwritecom(0x06);
LCD_Delay1ms(10);
Lcdwritecom(0x0c);
}
void Lcdwritecom( uchar com)
{
LCD_RS=0;
LCD_RW=0;
LCD_EN=0;
P0=com;
LCD_Delay1ms(10);
LCD_EN=1;
LCD_Delay1ms(10);
LCD_EN=0;
}
void Lcdwritedate( uchar dat)
{
LCD_RS=1;
LCD_RW=0;
LCD_EN=0;
P0=dat;
LCD_Delay1ms(10);
LCD_EN=1;
LCD_Delay1ms(10);
LCD_EN=0;
}
void main(void)
{
unsigned char i;
LCD_Delay1ms(10);
LcdInit();
while(1)
{
Lcdwritecom(0x80);
for(i=0;i<16;i++)
Lcdwritedate(lin1[i]);
Lcdwritecom(0x90);
for(i=0;i<16;i++)
Lcdwritedate(lin2[i]);
Lcdwritecom(0x88);
for(i=0;i<16;i++)
Lcdwritedate(lin3[i]);
Lcdwritecom(0x98);
for(i=0;i<16;i++)
Lcdwritedate(lin4[i]);
}
}

评论

共有 条评论