IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 嵌入式 -> 关于51单片机,多个74HC595和8x8点阵的使用 6个(16x16点阵)显示有些问题 -> 正文阅读

[嵌入式]关于51单片机,多个74HC595和8x8点阵的使用 6个(16x16点阵)显示有些问题

关于51单片机以及74HC595,8x8点阵的使用 6个(16x16点阵)

(入门者写勿喷)
仿真图
链接:https://pan.baidu.com/s/1JSrtxjnzWJyPfvOLtnEGkg
提取码:zkmf

代码如下
`#include <at89x51.h>
#include “intrins.h”
typedef unsigned int uint;
typedef unsigned char uchar;

sbit SRCLK1 = P1^0;
sbit SER1 = P1^1;
sbit RCLK1 = P1^2;
sbit SRCLK2 = P1^3;
sbit SER2 = P1^4;
sbit RCLK2 = P1^5;
							// 负责扫描

uchar code ledwei[]={
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
// 滚动显示
uchar code ledduan1[]={
// 起始屏幕空白
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
// 显示 中国梦我的梦
0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,
0xFF,0xFF,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0xF0,0x0F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFE,0xFF,0x02,0x40,0x12,0x48,0x92,0x48,0x92,0x48,0x92,0x48,
0xF2,0x4F,0x92,0x48,0x92,0x4A,0x92,0x4C,0x12,0x48,0x02,0x40,0xFE,0xFF,0x00,0x00,
0x00,0x00,0x40,0x00,0x44,0x80,0x24,0x88,0x14,0x84,0x7F,0x42,0x94,0x45,0x24,0x29,
0x00,0x11,0x24,0x11,0x14,0x09,0x7F,0x05,0x14,0x03,0x24,0x00,0x44,0x00,0x40,0x00,
0x00,0x00,0x20,0x00,0x24,0x08,0x24,0x48,0x24,0x84,0xFE,0x7F,0x23,0x02,0x22,0x41,
0x20,0x40,0x20,0x20,0xFF,0x13,0x20,0x0C,0x22,0x14,0x2C,0x22,0xA0,0x41,0x20,0xF8,
0x00,0x00,0x00,0x00,0xF8,0x7F,0x0C,0x21,0x0B,0x21,0x08,0x21,0x08,0x21,0xF8,0x7F,
0x40,0x00,0x30,0x00,0x8F,0x00,0x08,0x43,0x08,0x80,0x08,0x40,0xF8,0x3F,0x00,0x00,
0x00,0x00,0x40,0x00,0x44,0x80,0x24,0x88,0x14,0x84,0x7F,0x42,0x94,0x45,0x24,0x29,
0x00,0x11,0x24,0x11,0x14,0x09,0x7F,0x05,0x14,0x03,0x24,0x00,0x44,0x00,0x40,0x00,

							// 显示  去除乱码

0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,
0xFF,0xFF,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0xF0,0x0F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFE,0xFF,0x02,0x40,0x12,0x48,0x92,0x48,0x92,0x48,0x92,0x48,
0xF2,0x4F,0x92,0x48,0x92,0x4A,0x92,0x4C,0x12,0x48,0x02,0x40,0xFE,0xFF,0x00,0x00,
0x00,0x00,0x40,0x00,0x44,0x80,0x24,0x88,0x14,0x84,0x7F,0x42,0x94,0x45,0x24,0x29,
0x00,0x11,0x24,0x11,0x14,0x09,0x7F,0x05,0x14,0x03,0x24,0x00,0x44,0x00,0x40,0x00,
0x00,0x00,0x20,0x00,0x24,0x08,0x24,0x48,0x24,0x84,0xFE,0x7F,0x23,0x02,0x22,0x41,
0x20,0x40,0x20,0x20,0xFF,0x13,0x20,0x0C,0x22,0x14,0x2C,0x22,0xA0,0x41,0x20,0xF8,
0x00,0x00,0x00,0x00,0xF8,0x7F,0x0C,0x21,0x0B,0x21,0x08,0x21,0x08,0x21,0xF8,0x7F,
0x40,0x00,0x30,0x00,0x8F,0x00,0x08,0x43,0x08,0x80,0x08,0x40,0xF8,0x3F,0x00,0x00,
0x00,0x00,0x40,0x00,0x44,0x80,0x24,0x88,0x14,0x84,0x7F,0x42,0x94,0x45,0x24,0x29,
0x00,0x11,0x24,0x11,0x14,0x09,0x7F,0x05,0x14,0x03,0x24,0x00,0x44,0x00,0x40,0x00,

};
//静止显示
uchar code inc [] = {
0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,
0xFF,0xFF,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0xF0,0x0F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFE,0xFF,0x02,0x40,0x12,0x48,0x92,0x48,0x92,0x48,0x92,0x48,
0xF2,0x4F,0x92,0x48,0x92,0x4A,0x92,0x4C,0x12,0x48,0x02,0x40,0xFE,0xFF,0x00,0x00,
0x00,0x00,0x40,0x00,0x44,0x80,0x24,0x88,0x14,0x84,0x7F,0x42,0x94,0x45,0x24,0x29,
0x00,0x11,0x24,0x11,0x14,0x09,0x7F,0x05,0x14,0x03,0x24,0x00,0x44,0x00,0x40,0x00,
0x00,0x00,0x20,0x00,0x24,0x08,0x24,0x48,0x24,0x84,0xFE,0x7F,0x23,0x02,0x22,0x41,
0x20,0x40,0x20,0x20,0xFF,0x13,0x20,0x0C,0x22,0x14,0x2C,0x22,0xA0,0x41,0x20,0xF8,
0x00,0x00,0x00,0x00,0xF8,0x7F,0x0C,0x21,0x0B,0x21,0x08,0x21,0x08,0x21,0xF8,0x7F,
0x40,0x00,0x30,0x00,0x8F,0x00,0x08,0x43,0x08,0x80,0x08,0x40,0xF8,0x3F,0x00,0x00,
0x00,0x00,0x40,0x00,0x44,0x80,0x24,0x88,0x14,0x84,0x7F,0x42,0x94,0x45,0x24,0x29,
0x00,0x11,0x24,0x11,0x14,0x09,0x7F,0x05,0x14,0x03,0x24,0x00,0x44,0x00,0x40,0x00,

};

void delay(uchar xms) //延时函数 for与while
{
uint i,j;
for(i=xms; i>0; i–){
for(j=240; j>0; j–){ }}
}
void delay1(uint i){
while(i–);
}

void Hc595SendByte(uchar dat1,uchar dat2,uchar dat3,uchar dat4,uchar dat5,uchar dat6,uchar dat7,uchar dat8,uchar dat9,uchar dat10,uchar dat11,uchar dat12,uchar dat13,uchar dat14){
uchar a;
SRCLK1 = 1;
RCLK1 = 1;
SRCLK2 = 1;
RCLK2 = 1;
for(a=0;a<8;a++) //发送8位数 1
{
SER1 = dat1 >> 7; //从最高位开始发送
dat1 <<= 1;
SRCLK1 = 0; //发送时序

	  SRCLK1 = 1;          
	}     
  for(a=0;a<8;a++)            //发送8位数    2   
	{               
		SER1 = dat2 >> 7;         //从最高位开始发送        
		dat2 <<= 1;         
		SRCLK1 = 0;               //发送时序      
		
	  SRCLK1 = 1;          
	}   
	for(a=0;a<8;a++)            //发送8位数    3   
	{               
		SER1 = dat3 >> 7;         //从最高位开始发送        
		dat3 <<= 1;         
		SRCLK1 = 0;               //发送时序      
		
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    4   
	{               
		SER1 = dat4 >> 7;         //从最高位开始发送        
		dat4 <<= 1;         
		SRCLK1 = 0;               //发送时序      
  			
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    5  
	{               
		SER1 = dat5 >> 7;         //从最高位开始发送        
		dat5 <<= 1;         
		SRCLK1 = 0;               //发送时序      
	  			
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    6   
	{               
		SER1 = dat6 >> 7;         //从最高位开始发送        
		dat6 <<= 1;         
		SRCLK1 = 0;               //发送时序      
  		
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    7  
	{               
		SER1 = dat7 >> 7;         //从最高位开始发送        
		dat7 <<= 1;         
		SRCLK1 = 0;               //发送时序      
  			
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    8   
	{               
		SER1 = dat8 >> 7;         //从最高位开始发送        
		dat8 <<= 1;         
		SRCLK1 = 0;               //发送时序      
  			
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    9  
	{               
		SER1 = dat9 >> 7;         //从最高位开始发送        
		dat9 <<= 1;         
		SRCLK1 = 0;               //发送时序      
  			
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    10   
	{               
		SER1 = dat10 >> 7;        //从最高位开始发送        
		dat10 <<= 1;         
		SRCLK1 = 0;               //发送时序      
	
	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    11  
	{               
		SER1 = dat11 >> 7;        //从最高位开始发送        
		dat11 <<= 1;         
		SRCLK1 = 0;               //发送时序      

	  SRCLK1 = 1;          
	} 
	for(a=0;a<8;a++)            //发送8位数    12   
	{               
		SER1 = dat12 >> 7;        //从最高位开始发送        
		dat12 <<= 1;         
		SRCLK1 = 0;               //发送时序      

	  SRCLK1 = 1;          
	} 
	
	for(a=0;a<8;a++)           //发送8位数   13  
	{          
		SER2 = dat13 >> 7;       //从最高位开始发送       
		dat13 <<= 1;        
		SRCLK2 = 0;              //发送时序        

	  SRCLK2 = 1;         
	 }   
	 for(a=0;a<8;a++)          //发送8位数    14
	 {         
		 SER2 = dat14 >> 7;      //从最高位开始发送      
		 dat14 <<= 1;        
		 SRCLK2 = 0;             //发送时序         
	       
		 SRCLK2 = 1;         
	 }      
	  RCLK1 = 0;	
	  RCLK2 = 0;    
	  RCLK1 = 1;	
	  RCLK2 = 1;

}
// ********************* 列扫描 *************************
void main(){
uint i,a,s;
while(1)
{
for(a=0;a<3213;a+=2) //汉字的切换
{
if(a==32
12){a=326;}
for(s=0;s<1000000;s++) //控制运行速度(极限静止)
{
for(i=0;i<16;i++) //显示每个汉字
{ // 静止
Hc595SendByte(inc[2
i+a+160+1],inc[2i+a+160],inc[2i+a+128+1],inc[2i+a+128],inc[2i+a+96+1],inc[2i+a+96],inc[2i+a+64+1],inc[2i+a+64],inc[2i+a+32+1],inc[2i+a+32],inc[2i+a+1],inc[2i+a],ledwei[i+16],ledwei[i]);
// 滚动
//Hc595SendByte(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
//Hc595SendByte(ledduan1[2
i+a+160+1],ledduan1[2i+a+160],ledduan1[2i+a+128+1],ledduan1[2i+a+128],ledduan1[2i+a+96+1],ledduan1[2i+a+96],ledduan1[2i+a+64+1],ledduan1[2i+a+64],ledduan1[2i+a+32+1],ledduan1[2i+a+32],ledduan1[2i+a+1],ledduan1[2*i+a],ledwei[i+16],ledwei[i]);
这个实现静止止扫描有些离谱,并且扫描有的点显示不成功利用二次扫描也就是许多0x00,就会频闪,请在评论区留言,感谢大佬在百忙之中抽出时间来帮助我
这个可以实现滚动扫描,换第二个数组,写程序时,同时也参考了某位大佬的

					} 
				}						
			}		
	}               

}

		`
  嵌入式 最新文章
基于高精度单片机开发红外测温仪方案
89C51单片机与DAC0832
基于51单片机宠物自动投料喂食器控制系统仿
《痞子衡嵌入式半月刊》 第 68 期
多思计组实验实验七 简单模型机实验
CSC7720
启明智显分享| ESP32学习笔记参考--PWM(脉冲
STM32初探
STM32 总结
【STM32】CubeMX例程四---定时器中断(附工
上一篇文章      下一篇文章      查看所有文章
加:2021-12-11 15:53:12  更:2021-12-11 15:53:14 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2025年1日历 -2025/1/9 2:11:05-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码