我已经做到能够静止显示一个字,求助各位可以看一看怎么让他滚动显示
源码
#include"reg51.h"
#define uchar unsigned char
#define uint unsigned int
sbit STCP=P3^2;
sbit OE=P3^3;
void delay (uint t)
{
uint i,j;
for (i=t; i>0;i--)
for (j=110; j>0; j--);
}
out595 (uchar outdata)
{
SBUF=outdata;
while (TI==0);
TI=0;
}
main ()
{
uchar i;
uchar code tab [] ={0x08,0x00,0x88,0x1F,0x08,0x08,0x08,0x04,0x3F,0x02,0x08,0x01,0x8C,0x7F,0x1C,0x49,
0x2A,0x49,0x2A,0x49,0x89,0x48,0x88,0x44,0x48,0x44,0x28,0x42,0x08,0x29,0x88,0x10};/*"杨",0*/
while (1)
{
for (i=0; i<16; i++)
{
P1=i;
STCP=1;
out595 (tab [2*i+1]);
out595 (tab [2*i]);
STCP=0;STCP=1;
OE=0;
delay (2);
OE=1;
}
}
}
|