萌新请问普中51单片机的点阵输出问题

图片说明图片说明图片说明图片说明

代码使用的是论坛里下载的输出生日快乐的代码。但是烧录完成后点阵不显示,但动态数码管首位一直在闪烁。

#include "reg51.h"
#include "intrins.h"
#define COM_D P0
typedef unsigned int u2;
typedef unsigned char u1;
sbit SRCLK=P3^6;
sbit RCLK=P3^5;
sbit SER=P3^4;

u1 ledwei[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};

u2 ledduan[4][8]={0x12,0x2a,0x6a,0x2a,0xfe,0x2a,0x2a,0x02,
0x00,0x00,0x7f,0x49,0x49,0x7f,0x00,0x00,
0x10,0x7f,0x10,0x29,0x2a,0x7c,0x3a,0x09,
0x00,0x00,0x3a,0x2e,0x5f,0x8c,0x0a,0x00};

void delay(u2 i)
{
while(i--);
}

void Hc595Send(u1 dat)
{
u1 a;
SRCLK=0;
RCLK=0;
for(a=0;a {
SER=dat>>7;
dat<<=1;

SRCLK=1;
nop();
nop();
SRCLK=0;
}

RCLK=1;
nop();
nop();
RCLK=0;
}

void main()
{
u1 tab,j;u2 i;
while(1)
{
for(i=0;i<251;i++)
{
for(tab=0;tab<8;tab++)
Hc595Send(0x00);
COM_D=ledwei[tab];
Hc595Send(ledduan[j][tab]);
delay(10);
}
j++;
if(j==4)
{
j=0;
}
}
}

查看全部
CornIT
CornIT
2020/04/18 22:42
  • c语言
  • 点赞
  • 收藏
  • 回答
    私信

1个回复