#include <htc.h>
__CONFIG(0x3F3A);
#define _XTAL_FREQ 20e6
#define reset RB7=1;RB7=0;
#define clock RB6=1;RB6=0;
char buffer[10],p;
unsigned short int still,i,j,s;
void scroll(short int a,short int b,short int c,short int d,short int e)
{
short int count=6;
while(count>0)
{
buffer[0]=~a;
a=b;b=c;c=d;d=e;e=255;
reset;
for(s=0;s<still;s++)
{
for(i=0;i<10;i++)
{
p=1;
for(j=0;j<9;j++)
{
PORTD=~(buffer[i]&(p));__delay_ms(.1);p<<=1;
}
clock;
}
}
for(i=9;i>0;i--)
{
buffer[i]=buffer[i-1];
}
count--;
}
}
void A(){scroll(0xC1, 0xB7, 0x77, 0xB7, 0xC1);} //letter A
void B(){scroll(0x01, 0x6D, 0x6D, 0x6D, 0x93);}
void C(){scroll(0x83, 0x7D, 0x7D, 0x7D, 0xBB);}
void D(){scroll(0x01, 0x7D, 0x7D, 0xBB, 0xC7);}
void E(){scroll(0x01, 0x6D, 0x6D, 0x6D, 0x7D);}
void F(){scroll(0x01, 0x6F, 0x6F, 0x6F, 0x7F);}
void G(){scroll(0x83, 0x7D, 0x65, 0x6D, 0xA3);}
void H(){scroll(0x01, 0xEF, 0xEF, 0xEF, 0x01);}
void I(){scroll(0x7D, 0x7D, 0x1, 0x7D, 0x7D);}
void J(){scroll(0xF3, 0x7D, 0x7D, 0x03, 0x7F);}
void K(){scroll(0x01, 0xEF, 0xD7, 0xBB, 0x7D);}
void L(){scroll(0x01, 0xFD, 0xFD, 0xFD, 0xFD);}
void M(){scroll(0x01, 0xBF, 0xDF, 0xBF, 0x01);}
void N(){scroll(0x01, 0xBF, 0xDF, 0xEF, 0x01);}
void O(){scroll(0x83, 0x7D, 0x7D, 0x7D, 0x83);}
void P(){scroll(0x01, 0x6F, 0x6F, 0x6F, 0x9F);}
void Q(){scroll(0x83, 0x7D, 0x75, 0x79, 0x81);}
void R(){scroll(0x01, 0x6F, 0x6F, 0x6F, 0x91);}
void S(){scroll(0x9B, 0x6D, 0x6D, 0x6D, 0xB3);}
void T(){scroll(0x7F, 0x7F, 0x01, 0x7F, 0x7F);}
void U(){scroll(0x03, 0xFD, 0xFD, 0xFD, 0x03);}
void V(){scroll(0x07, 0xFB, 0xFD, 0xFB, 0x07);}
void W(){scroll(0x01, 0xFB, 0xF7, 0xFB, 0x01);}
void X(){scroll(0x39, 0xD7, 0xEF, 0xD7, 0x39);}
void Y(){scroll(0x3F, 0xDF, 0xE1, 0xDF, 0x3F);}
void Z(){scroll(0x79, 0x75, 0x6D, 0x5D, 0x3D);}
void D0(){scroll(0x83, 0x7D, 0x7D, 0x7D, 0x83);} //NUM 0
void D1(){scroll(0xDD, 0xBD, 0x1, 0xFD, 0xFD);}
void D2(){scroll(0xBD, 0x79, 0x75, 0x6D, 0x9D);}
void D3(){scroll(0x7B, 0x7D, 0x5D, 0x4D, 0x33);}
void D4(){scroll(0xCF, 0xAF, 0x6F, 0xEF, 0x1);}
void D5(){scroll(0xB, 0x5D, 0x5D, 0x5D, 0x63);}
void D6(){scroll(0x83, 0x6D, 0x6D, 0x6D, 0xB3);}
void D7(){scroll(0x79, 0x77, 0x6F, 0x5F, 0x3F);}
void D8(){scroll(0x93, 0x6D, 0x6D, 0x6D, 0x93);}
void D9(){scroll(0x9B, 0x6D, 0x6D, 0x6D, 0x83);}
void SP(){scroll(255,255,255,255,255);}
main()
{
TRISB6=0;TRISB7=0;RB7=0;TRISD=0;
still=8;
while(1)
{
E();D();A();B();O();A();R();D();SP(); //LETTERS TO BE SCROLLED
}
}