本帖最后由 ghw1997 于 2020-1-22 13:53 编辑
大佬门 我错了 我忘记把外接时钟给拔掉。。。程序是对的 点阵乱亮 我就挨个查,结果就查到0xff不亮,纠结了好久,刚看到跳线帽子没拔。。。
#include"reg52.h"
***it rck=P3^5;
***it sck=P3^6;
***it si=P3^4 ;
int code duan[]={
0x00,0x00,0x08,0x88,0x68,0x08,0x08,0x0F,0x08,0x08,0x28,0xC8,0x08,0x00,0x00,0x00,
0x81,0x81,0x82,0x82,0x84,0x88,0xB0,0xC0,0xB0,0x88,0x84,0x82,0x82,0x81,0x81,0x00,
};
int code wei[]={
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,
} ;
void spend( unsigned char i1,unsigned char i2,
unsigned char i3,unsigned char i4)
{
char a;
for(a=0;a<8;a++)
{
si=i1>>7;
i1<<=1;
sck=0;
sck=1;
}
for(a=0;a<8;a++)
{
si=i2>>7;
i2<<=1;
sck=0;
sck=1;
}
for(a=0;a<8;a++)
{
si=i3>>7;
i3<<=1;
sck=0;
sck=1;
}
for(a=0;a<8;a++)
{
si=i4>>7;
i4<<=1;
sck=0;
sck=1;
}
}
void delay(int i)
{
while(--i) ;
}
void main()
{ int i;
while(1)
{
for(i=0;i<16;i++)
{
spend(~wei[i+16],~wei
,duan[i+16],duan);
rck=0;
rck=1;
delay(10);
}
}
本帖最后由 ghw1997 于 2020-1-22 13:53 编辑
大佬门 我错了 我忘记把外接时钟给拔掉。。。程序是对的 点阵乱亮 我就挨个查,结果就查到0xff不亮,纠结了好久,刚看到跳线帽子没拔。。。
#include"reg52.h"
***it rck=P3^5;
***it sck=P3^6;
***it si=P3^4 ;
int code duan[]={
0x00,0x00,0x08,0x88,0x68,0x08,0x08,0x0F,0x08,0x08,0x28,0xC8,0x08,0x00,0x00,0x00,
0x81,0x81,0x82,0x82,0x84,0x88,0xB0,0xC0,0xB0,0x88,0x84,0x82,0x82,0x81,0x81,0x00,
};
int code wei[]={
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,
} ;
void spend( unsigned char i1,unsigned char i2,
unsigned char i3,unsigned char i4)
{
char a;
for(a=0;a<8;a++)
{
si=i1>>7;
i1<<=1;
sck=0;
sck=1;
}
for(a=0;a<8;a++)
{
si=i2>>7;
i2<<=1;
sck=0;
sck=1;
}
for(a=0;a<8;a++)
{
si=i3>>7;
i3<<=1;
sck=0;
sck=1;
}
for(a=0;a<8;a++)
{
si=i4>>7;
i4<<=1;
sck=0;
sck=1;
}
}
void delay(int i)
{
while(--i) ;
}
void main()
{ int i;
while(1)
{
for(i=0;i<16;i++)
{
spend(~wei[i+16],~wei,duan[i+16],duan);
rck=0;
rck=1;
delay(10);
}
}
举报