#include <reg51.h>
void wait (unsigned int);
char colIndex,charData,scrolVar,refreshCount;
void main(void)
{
code unsigned char dataR[] = {
0x7c,
0x08,
0x10,
0x20,
0x7c,
0x00,
0x44,
0x7c,
0x44,
0x00,
0x04,
0x04,
0x7c,
0x04,
0x04,
0x00,
0x44,
0x7c,
0x44,
0x00,
0x7c,
0x08,
0x10,
0x20,
0x7c,
};
code unsigned char P0C[] = {
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x01,
0x00,
};
code unsigned char P1C[] = {
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0x7f,
0xbf,
0xdf,
0xef,
0xf7,
0xfb,
0xfd,
0xfe,
0xff,
};
code unsigned char P2C[] = {
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0x7f,
0xbf,
0xdf,
0xef,
0xf7,
0xfb,
0xfd,
0xfe,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
};
code unsigned char P3C[] = {
0x7f,
0xbf,
0xdf,
0xef,
0xf7,
0xfb,
0xfd,
0xfe,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
};
scrolVar = 25;
refreshCount=100;
for(; ;)
{
for(colIndex=0;colIndex<25;colIndex=colIndex+1)
{
if(colIndex-scrolVar < 0)
{
charData = 0x00;
}
else
{
charData = dataR[colIndex-scrolVar] | P0C[colIndex];
}
P0= 0x00;
P1 = P1C[colIndex];
P2 = P2C[colIndex];
P3 = P3C[colIndex];
P0 = charData;
wait(1);
refreshCount--;
if(refreshCount==0)
{
refreshCount=100;
if(scrolVar == -25)
scrolVar = 25;
else
scrolVar = scrolVar-1;
}
}
}
}
void wait( unsigned int time)
{
unsigned int j,k;
for(j=0;j<time;j++)
for(k=0;k<100;k++);
}