刚好,我上个星期写了个向上滚动的,字有点自恋,我就不改了 上程序
#include
#include
#define uchar unsigned char
#define uint unsigned int
sbit DZ_ds=P2^0; // 595 串行口
sbit DZ_sh=P2^1; // 串行输入时钟端口
sbit DZ_st=P2^2; // 并行输出时钟端口
uchar DisBuff[7];
uchar code numtab1[]={ //字序已更改,num*2 num*2+1 这更要注意了,为了方便一般把字序改动了
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xff,0x7f,0xff,0x7f,0x03,0x7f,0xfb,0x03,0xfa,0xfb,0xb6,0xf7,0xd5,0xbf,0xeb,0xbf,
0xef,0xbf,0xd7,0x5f,0xdb,0x5f,0xba,0xef,0x7e,0xef,0xfd,0xf7,0xfb,0xfb,0xf7,0xfd,
0xFF,0xFF,0xFF,0xFF, //欢
0xff,0xff,0x80,0x03,0xff,0xef,0xe0,0x6f,0xef,0x6f,0xef,0x6f,0xe0,0x6f,0xff,0xef,
0x00,0x01,0xff,0xef,0xe0,0x6f,0xef,0x6f,0xef,0x6f,0xe0,0x6f,0xff,0xaf,0xff,0xcf,
0xFF,0xFF,0xFF,0xFF, //哥
0xe0,0x0f,0xef,0xef,0xe0,0x0f,0xef,0xef,0xe0,0x0f,0xff,0xff,0x00,0x01,0xdd,0xff,
0xc1,0x07,0xdd,0x77,0xc1,0x6f,0xdd,0xaf,0xd0,0xdf,0x0d,0xaf,0xbd,0x77,0xfc,0xf9,
0xFF,0xFF,0xFF,0xFF, //最
0xff,0xff,0x06,0x03,0xf6,0xfb,0xf6,0xfb,0xf6,0x03,0x87,0xdf,0xbf,0xdf,0xbc,0x01,
0xbd,0xdd,0x85,0xdd,0xf4,0x01,0xf7,0xdf,0xf7,0xdb,0xf7,0xdd,0xa8,0x01,0xdf,0xfd,
0xFF,0xFF,0xFF,0xFF, //强
0xef,0xff,0xee,0x03,0xee,0xfb,0xee,0x03,0xe6,0xfb,0xaa,0x03,0xaf,0xff,0xaf,0xff,
0x6e,0x03,0xef,0xdf,0xef,0xdf,0xec,0x01,0xef,0xdf,0xef,0xdf,0xef,0xdf,0xef,0xdf,
0xFF,0xFF,0xFF,0xFF, //悍
0xfe,0xff,0xfe,0xff,0xfd,0x7f,0xfd,0x7f,0xfd,0x7f,0xfb,0xbf,0x03,0x81,0xbf,0xfb,
0xcf,0xe7,0xf7,0xdf,0xf7,0xdf,0xee,0x6f,0xe9,0xaf,0xe7,0xcf,0xdf,0xf7,0xff,0xff,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
};
/***********************************
-功能描述: 串行数据输入
-函数属性:点阵扫描延时
***********************************/
void write_byte(uchar dat)
{
uchar i;
for(i=0;i<8;i++)
{
DZ_ds=(dat&0x80); // ds 数据送
DZ_sh=0;
_nop_();
_nop_();
DZ_sh=1; // 数据送入595
dat<<=1;
}
}
void write_byte(uchar dat)
{
uchar i;
for(i=0;i<8;i++)
{
DZ_ds=(dat&0x80); // ds1 数据送
DZ_sh=0;
_nop_();
_nop_();
DZ_sh=1; // 数据送入595
dat<<=1;
}
}
void main()
{
uchar num ,i,x,y,j,temp,k;
while(1)
{ for(y=0;y<1;y++)
{
for(num=0;num<16;num++)
{
write_byte(~numtab1[num*2+i]);
write_byte(~numtab1[num*2+1+i]);
P1=num;
DZ_st=0;
_nop_();
_nop_();
DZ_st=1;
}
}
if(++x==8)
{
x=0;
if(++k==50)
k=0;
}
i+=2;
if(i==246)
{
i=0;
}
}
}
里面可能有一些没有必要的定义和变量,因为我程序不止这一个功能,可能没删彻底,不懂再问,我天天在学校
你这个问题就是让别人给你写程序了。。。没人会有时间看的。。。。