您的位置 首页 应用

51单片机—8*8LED点阵—09—①

LED点阵,相信肯定知道单片机的人都该知道这个,我也就是一步一步发吧~~今天这个就是简单的控制8*8LED点阵亮0~F这16个数字,暂时不加左移啊

LED点阵,信任必定知道单片机的人都该知道这个,我也便是一步一步发吧~~

今日这个便是简略的操控8*8LED点阵亮0~F这16个数字,暂时不加左移啊~~,上移啊~~以及16*16的点阵呢~~

不过也就这些天都发出来吧~~

呵呵~~

8*8LED点阵显现0~F(这儿是静态显现)

留意:

用Proteus仿真开端还真的不知道那个是行,那个是列~~

还得糟蹋我时刻一点点看人家他人的东东~~

1)赤色LED上边为列,下边为行(其它色彩的正好相反,上为行,下为列~~)

2)关于赤色来说,上边的列最低位在最右边;下边的行最低位也是恰好相反,在最左面(一会看图就知道了,我的就写反了~~正好能够反过来看了~~)

基本上就这么两点的留意事项~~

然后便是程序了:

LED.c

//——————————————————————————
//曾经还真的没仿真过LED点阵,今日正好没工作做~~
//留意一点吧,赤色的上为列,下为行,其它色彩正好相反~~(条件是我也没记错的情况下~~呵呵,刚实验了一下,对的~~)
#include”reg52.h”
#include”delay.h”
#include”macroandconst.h”
//——————————————————————————
#define ROW P0
#define LINE P2
uchar code row[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//送别
uchar code line[16][8]={
{0x1c,0x22,0x22,0x22,0x22,0x22,0x22,0x1c},//0 留意:这儿的数据是翻转的,由于关于赤色来说,这儿上边为列,最低位在最右边,下边为行,最低位在最左面
{0x08,0x0c,0x08,0x08,0x08,0x08,0x08,0x1c},//1
{0x1c,0x22,0x22,0x10,0x08,0x04,0x02,0x3e},//2
{0x1c,0x22,0x20,0x18,0x20,0x20,0x22,0x1c},//3
{0x10,0x18,0x14,0x14,0x12,0x7c,0x10,0x38},//4
{0x3e,0x02,0x02,0x1e,0x20,0x20,0x20,0x1c},//5
{0x1c,0x22,0x02,0x1e,0x22,0x22,0x22,0x1c},//6
{0x3e,0x12,0x10,0x08,0x08,0x08,0x08,0x08},//7
{0x1c,0x22,0x22,0x1c,0x22,0x22,0x22,0x1c},//8
{0x1c,0x22,0x22,0x22,0x3c,0x20,0x22,0x1c},//9
{0x08,0x08,0x18,0x14,0x14,0x3c,0x24,0x66},//A
{0x1e,0x24,0x24,0x1c,0x24,0x24,0x24,0x1e},//B
{0x3c,0x22,0x02,0x02,0x02,0x02,0x22,0x1c},//C
{0x1e,0x24,0x24,0x24,0x24,0x24,0x24,0x1e},//D
{0x3e,0x24,0x14,0x1c,0x14,0x04,0x24,0x3e},//E
{0x3e,0x24,0x14,0x1c,0x14,0x04,0x04,0x0e},//F
};
uchar num;
uchar times;
uchar count;
//——————————————————————————
//main
void main()
{
while(1)
{
for(num=0;num<16;num++)
{
for(times=0;times<50;times++)
{
for(count=0;count<8;count++)//改写行和列
{
ROW=0XFF;//每次都要消影,便是让行都为低电平
LINE=line[num][count];
ROW=row[count];
delay(2);//延时100ms
}
}
}
}
}

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

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

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

微信扫一扫关注我们

返回顶部