|
1金钱
本帖最后由 965560242 于 2020-8-3 23:40 编辑
大神可以帮忙看看吗
#include<reg52.h>
#include<intrins.h>
sbit SER = P3^4;
sbit RCLK = P3^5;
sbit SRCLK = P3^6;
unsigned char code image[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x85,0xFC,0xFC,0x85,0x01,0x00,
0xE0,0xF1,0xF9,0xFC,0xFC,0xF9,0xF1,0xE0,
0x00,0xF8,0xFC,0x0C,0x0C,0xFC,0xF8,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
unsigned char code hang[] = {
0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,
};
void hc595SendByte(unsigned char date)
{
unsigned char i;
SRCLK = 0;
RCLK = 0;
for(i=0;i<=7;i++)
{
SER = date >> 7;
date <<= 1;
SRCLK = 1;
_nop_();
_nop_();
SRCLK = 0;
}
RCLK = 1;
_nop_();
_nop_();
RCLK = 0;
}
void main()
{
static unsigned char index = 0;
static unsigned char a;
static unsigned char tmr = 0;
TMOD = 0x01;
TH0 = 0xFC;
TL0 = 0x18;
TR0 = 1;
while(1)
{
for(a=0;a<=7;a++)
{
P0 = hang[a];
hc595SendByte(image[a]);
hc595SendByte(0x00);
}
if(TF0 == 1)
{
TF0 = 0;
TH0 = 0xFC;
TL0 = 0x18;
tmr++;
if(tmr >= 250)
{
tmr = 0;
index++;
if(index >= 32)
{
index = 0;
}
}
}
}
}
我知道答案
本帖寻求最佳答案回答被采纳后将获得系统奖励 10 金钱 , 目前已有 2人回答
|
|