51单片机简单型的 LED液晶 显示(整屏转移)字符
时间:10-02
整理:3721RD
点击:
高手老师请多多指点~~
简单型的 LED液晶 显示(动态整屏偏移)字符
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit lcdrs=P3^5;
sbit lcden=P3^4;
uchar code fengzi[]="I LOVE YOU";
uchar code fengzi1[]="I LOVE NICO";
uchar num;
void yanshi(uint z)
{
uint a,b;
for(a=z;a>0;a--)
for(b=110;b>0;b--);
}
void write_ccd(uchar com)
{
lcdrs=0;
P0=com;
yanshi(10);
lcden=1;
yanshi(10);
lcden=0;
}
void write_data(uchar date)
{
lcdrs=1;
P0=date;
yanshi(10);
lcden=1;
yanshi(10);
lcden=0;
}
void init()
{
dula=0;
wela=0;
lcden=0;
write_ccd(0x38);
write_ccd(0x0f);
write_ccd(0x06);
write_ccd(0x01);
}
void main()
{
init();
write_ccd(0x80+0x10);
for(num=0;num<10;num++)
{
write_data(fengzi[num]);
yanshi(20);
}
write_ccd(0x80+0x51);
for(num=0;num<11;num++)
{
write_data(fengzi1[num]);
yanshi(20);
}
for(num=0;num<16;num++)
{
write_ccd(0x18);
yanshi(300);
}
while(1);
}
简单型的 LED液晶 显示(动态整屏偏移)字符
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit lcdrs=P3^5;
sbit lcden=P3^4;
uchar code fengzi[]="I LOVE YOU";
uchar code fengzi1[]="I LOVE NICO";
uchar num;
void yanshi(uint z)
{
uint a,b;
for(a=z;a>0;a--)
for(b=110;b>0;b--);
}
void write_ccd(uchar com)
{
lcdrs=0;
P0=com;
yanshi(10);
lcden=1;
yanshi(10);
lcden=0;
}
void write_data(uchar date)
{
lcdrs=1;
P0=date;
yanshi(10);
lcden=1;
yanshi(10);
lcden=0;
}
void init()
{
dula=0;
wela=0;
lcden=0;
write_ccd(0x38);
write_ccd(0x0f);
write_ccd(0x06);
write_ccd(0x01);
}
void main()
{
init();
write_ccd(0x80+0x10);
for(num=0;num<10;num++)
{
write_data(fengzi[num]);
yanshi(20);
}
write_ccd(0x80+0x51);
for(num=0;num<11;num++)
{
write_data(fengzi1[num]);
yanshi(20);
}
for(num=0;num<16;num++)
{
write_ccd(0x18);
yanshi(300);
}
while(1);
}
这个是什么程序呀