您的位置 首页 传感器

51单片机程序——点阵显现汉字

includereg52h>defineuintunsignedintunsignedcharcodetab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe

#include

#define uint unsigned int
unsigned char code tab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
unsigned char code digittab[]={0x14,0x18,0xff,0x18,0x14,0x18,0xff,0x18}; //
unsigned char code digittab1[]={0x54,0xff,0x54,0x3f,0x55,0xfd,0x55,0x1d}; //
unsigned char code digittab2[]={0x54,0x10,0x5a,0xf6,0x5f,0xf6,0x5a,0x12}; //
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x–)
for(y=110;y>0;y–);
}
void main()
{
int i,t=50;
while(1)
{
while(t–)
{
for(i=0;i<8;i++)
{
P0=tab[i];
P1=digittab[i];
delay(5);
}
}
P0=0xff;
delay(100);
t=50;
while(t–)
{
for(i=0;i<8;i++)
{
P0=tab[i];
P1=digittab1[i];
delay(5);
}
}
P0=0xff;
delay(100);
t=50;
while(t–)
{
for(i=0;i<8;i++)
{
P0=tab[i];
P1=digittab2[i];
delay(5);
}
}
P0=0xff;
delay(100);
t=50;
}
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/yingyong/chuanganqi/260839.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部