首页 > 其他分享 >基于51单片机8x8点阵设计

基于51单片机8x8点阵设计

时间:2024-06-16 22:58:50浏览次数:30  
标签:0xE3 0xE7 8x8 51 单片机 0xDB 0xEF 0xDF 0xFF

基于51单片机8x8点阵设计

(仿真+程序)

功能介绍

具体功能:

1.用74HC138驱动8x8点阵;

2.按键可以切换模式;

3.一共4种模式,0~9数字闪出、动态爱心、坦克走动、数字依次向上平移;

​演示视频:

<iframe allowfullscreen="true" data-mediaembed="bilibili" frameborder="0" id="2NQxYhCP-1718247082565" src="https://player.bilibili.com/player.html?aid=1705585114"></iframe>

基于51单片机8x8点阵设计 

添加图片注释,不超过 140 字(可选)

程序

#include <reg52.h>
/***公众号:木子单片机****
************************************/
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
sbit KEY   = P3^5;

unsigned int cnt,m,stage,sec=1000;

unsigned char code image[][8] = {  
		{0xFF,0xE7,0xDB,0xDB,0xDB,0xDB,0xE7,0xFF},     //0
		{0xFF,0xE7,0xEF,0xEF,0xEF,0xEF,0xC3,0xFF},     //1
    {0xFF,0xE3,0xDF,0xDF,0xE7,0xFB,0xC3,0xFF},     //2
		{0xE3,0xDF,0xDF,0xE7,0xDF,0xDF,0xE3,0xFF},     //3
		{0xFF,0xEF,0xE7,0xEB,0xC3,0xEF,0xEF,0xFF},	  //4
		{0xFB,0xC3,0xFB,0xE3,0xDF,0xDF,0xE3,0xFF},		//5
		{0xE7,0xFB,0xFB,0xE3,0xDB,0xDB,0xE7,0xFF},    //6
		{0xFF,0xC3,0xDF,0xDF,0xDF,0xDF,0xDF,0xFF},    //7
		{0xE7,0xDB,0xDB,0xE7,0xDB,0xDB,0xE7,0xFF},    //8
		{0xE7,0xDB,0xDB,0xC7,0xDF,0xDF,0xE7,0xFF}     //9
};
unsigned char code image1[][8] = {              //心跳
		{0xFF,0x99,0x00,0x00,0x00,0x81,0xC3,0xE7},  //大心
		{0xFF,0xFF,0xDB,0x81,0x81,0xC3,0xE7,0xFF},  //中心
		{0xFF,0xFF,0xFF,0xDB,0xC3,0xE7,0xFF,0xFF},	 //小心
};

unsigned char code image3[][8] = {              //小坦克
	{0xFE,0xFF,0xE3,0xE3,0xF7,0xFF,0xFF,0xFF},
{0xFE,0xFF,0xFF,0xE3,0xE3,0xF7,0xFF,0xFF},
{0xFE,0xFF,0xFF,0xFF,0xE3,0xE3,0xF7,0xFF},
{0xFE,0xFF,0xFF,0xFF,0xF3,0xE3,0xF3,0xFF},
{0xFE,0xFF,0xFF,0xFF,0xE7,0xC7,0xE7,0xFF},
{0xFE,0xFF,0xFF,0xFF,0xCF,0x8F,0xCF,0xFF},
{0xFE,0xFF,0xFF,0xFF,0xDF,0x8F,0x8F,0xFF},
{0xFE,0xFF,0xFF,0xDF,0x8F,0x8F,0xFF,0xFF},
{0xFE,0xFF,0xDF,0x8F,0x8F,0xFF,0xFF,0xFF},
{0xFE,0xDF,0x8F,0x8F,0xFF,0xFF,0xFF,0xFF},
};

unsigned char code image2[] = {                  //0-->9平移
		0xFF,0xE7,0xDB,0x5A,0x5A,0xDB,0xE7,0xFF,0xFF,0xE7,0xEF,0x6E,0x6E,0xEF,0xC3,0xFF,
		0xFF,0xE3,0xDF,0x5E,0x66,0xFB,0xC3,0xFF,0xE3,0xDF,0xDF,0x66,0x5E,0xDF,0xE3,0xFF,
		0xFF,0xEF,0xE7,0x6A,0x42,0xEF,0xEF,0xFF,0xFB,0xC3,0xFB,0x62,0x5E,0xDF,0xE3,0xFF,
		0xE7,0xFB,0xFB,0x62,0x5A,0xDB,0xE7,0xFF,0xFF,0xC3,0xDF,0x5E,0x5E,0xDF,0xDF,0xFF,
		0xE7,0xDB,0xDB,0x66,0x5A,0xDB,0xE7,0xFF,0xE7,0xDB,0xDB,0x46,0x5E,0xDF,0xE7,0xFF,
};



void Delay10ms()		
{
	unsigned char i, j;

	i = 20;
	j = 113;
	do
	{
		while (--j);
	} while (--i);
}

硬件设计

使用元器件:

单片机:STC89C51;

(注意:单片机是通用的,无论51还是52、无论stc还是at都一样,引脚功能都一样。程序也是一样的。)

添加图片注释,不超过 140 字(可选)

设计资料

01仿真图

本设计使用Proteus8.9版本设计!具体如图!

添加图片注释,不超过 140 字(可选)

02程序

本设计使用软件keil5版本编程设计!具体如图!

添加图片注释,不超过 140 字(可选)

03设计资料

        资料获取请关注同名公众号,全部资料包括仿真源文件 、程序(含注释)等。具体内容如下,全网最全! !

 

可以关注下方公众号!

点赞分享一起学习成长。

标签:0xE3,0xE7,8x8,51,单片机,0xDB,0xEF,0xDF,0xFF
From: https://blog.csdn.net/2401_82402501/article/details/139648386

相关文章