你有基于89C51单片机C语言LCD1602液晶显示的程序吗?能给我吗?
3个回答
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
STM32是一种32位的微控制器,由意法半导体(STMicroelectronics)公司设计和生产。STM32是一种非常常见的嵌入式系统芯片,广泛应用于物联网、汽车、工业控制、医疗设备等领域。STM32具有以下特点:1. 体积小巧:STM...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
展开全部
我有的,网上也很多的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit rs=P3^5;
sbit lcden=P3^4;
uchar code table[]="2010-11-28 SUN";
uchar code table1[]=" 15:00:00";
uchar count,miao,shi,fen;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
rs=0;
lcden=0;
P0=com;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_date(uchar date)
{
rs=1;
lcden=0;
P0=date;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_sfm(uchar add,uchar date)
{
uchar shi,ge;
shi=date/10;
ge=date%10;
write_com(0x80+0x40+add);
write_date(0x30+shi);
write_date(0x30+ge);
}
void init()
{
uchar num;
dula=0;
wela=0;
lcden=0;
write_com(0x38);
write_com(0x06);
write_com(0x0c);
write_com(0x01);
write_com(0x80);
for(num=0;num<14;num++)
{
write_date(table[num]);
delay(5);
}
write_com(0x80+0x40);
for(num=0;num<10;num++)
{
write_date(table1[num]);
delay(5);
}
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
}
void main()
{
init();
while(1)
{
if(count==20)
{
count=0;
miao++;
if(miao==60)
{
miao=0;
fen++;
if(fen==60)
{
fen=0;
shi++;
if(shi==24)
{
shi=0;
}
write_sfm(2,shi);
}
write_sfm(5,fen);
}
write_sfm(8,miao);
}
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
count++;
}
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit rs=P3^5;
sbit lcden=P3^4;
uchar code table[]="2010-11-28 SUN";
uchar code table1[]=" 15:00:00";
uchar count,miao,shi,fen;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
rs=0;
lcden=0;
P0=com;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_date(uchar date)
{
rs=1;
lcden=0;
P0=date;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_sfm(uchar add,uchar date)
{
uchar shi,ge;
shi=date/10;
ge=date%10;
write_com(0x80+0x40+add);
write_date(0x30+shi);
write_date(0x30+ge);
}
void init()
{
uchar num;
dula=0;
wela=0;
lcden=0;
write_com(0x38);
write_com(0x06);
write_com(0x0c);
write_com(0x01);
write_com(0x80);
for(num=0;num<14;num++)
{
write_date(table[num]);
delay(5);
}
write_com(0x80+0x40);
for(num=0;num<10;num++)
{
write_date(table1[num]);
delay(5);
}
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
}
void main()
{
init();
while(1)
{
if(count==20)
{
count=0;
miao++;
if(miao==60)
{
miao=0;
fen++;
if(fen==60)
{
fen=0;
shi++;
if(shi==24)
{
shi=0;
}
write_sfm(2,shi);
}
write_sfm(5,fen);
}
write_sfm(8,miao);
}
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
count++;
}
追问
有51的吗?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询