#include <REGX51.H>
#include<delay.h>
sbit DS = P1^6; // Loading parallel data to HC165.
sbit SH_CP = P1^4;
sbit ST_CP = P1^5;
void sendserial(unsigned char);
unsigned char temp;
unsigned char a[]= { 0xFF, 0x88, 0x8C, 0x8A, 0x71, 0x00,
0x7E, 0x81, 0x81, 0x81, 0x7E,0x00,
0x7E, 0x81, 0x81, 0x81, 0x7E,0x00,
0xFF, 0x40, 0x30, 0x40, 0xFF, 0x00,
0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
void scroll_data(void);
unsigned int i2,l,i,j,k=32;
void main()
{
while(1)
scroll_data();
}
void sendserial(unsigned char Serial_data)
{ unsigned char compare_data ;
for (compare_data = 0x80; compare_data; compare_data>>=1)
{
if (Serial_data&compare_data)
DS = 1; // Data 1
else
DS = 0; // Data 0
SH_CP = 0;
SH_CP = 1;
}
}
void scroll_data(void)
{
for (i2=0; i2<4; i2++)
{
for(i=0; i<7;i++)
{
P3=(1<<i);
sendserial(~a[i]);
sendserial(~a[i+7]);
sendserial(~a[i+15]);
ST_CP = 0;
ST_CP = 1;
delay(5);
}
}
temp= a[0];
for(j=0; j<k; j++)
{
a[j] = a[j+1];
if(j==k-1)
{
a[j] = temp;
}
}
}