unsigned char V[8] = {0x81, 0x81, 0x81, 0x81, 0x42, 0x24, 0x18, 0x00};
unsigned char A[8] = {0x18, 0x24, 0x42, 0x42, 0x7E, 0x81, 0x81, 0x00};
unsigned char R[8] = {0xFC, 0x82, 0x82, 0xFC, 0x88, 0x84, 0x82, 0x00};
unsigned char S[8] = {0x7C, 0x82, 0x80, 0x7C, 0x02, 0x82, 0x7C, 0x00};
unsigned char H[8] = {0x81, 0x81, 0x81, 0xFF, 0x81, 0x81, 0x81, 0x00};
unsigned char I[8] = {0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00};
unsigned char N[8] = {0x81, 0xC1, 0xA1, 0x91, 0x89, 0x85, 0x83, 0x00};
unsigned char space[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
void port_initialization()
{
volatile char *portF_dir=(volatile char *)0x30;
volatile char *portK_dir=(volatile char *)0x107;
*portF_dir=0x03;
*portK_dir=0x01;
}
void outportF(char data1)
{
volatile char *portF_data= (volatile char *)0x31;
*portF_data=data1 & 0x03;
}
void outportK(char data2)
{
volatile char *portK_data=(volatile char *)0x108;
*portK_data=data2 & 0x01;
}
void clock_pulse(){
outportK(0x01);
delayMicroseconds(100);
outportK(0x00);
delayMicroseconds(100);
}
void latch()
{
outportF(0x02);
delayMicroseconds(50);
outportF(0x00);
delayMicroseconds(50);
}
void shift(unsigned char address,unsigned char data3)
{
for(int i=0;i<8;i++)
{
outportF(((address<<i)& 0x80)>>7);
clock_pulse();
}
for(int i=0;i<8;i++)
{
outportF(((data3<<i)&0x80)>>7);
clock_pulse();
}
}
void display_buffer(unsigned char in1[],unsigned char in2[])
{
for(int i=0;i<8;i++)
{
in2[i]=(((in2[i+8]<<i)&0x80)>>7) | (in2[i]<<1);
in2[i+8]=(((in2[i+16]<<i)&0x80)>>7) | (in2[i+8]<<1);
in2[i+16]=(((in2[i+24]<<i)&0x80)>>7) | (in2[i+8]<<1);
in2[i]=(in2[i+24]<<1) | (in1[i]&0x01);
}
}
void scroll_text(unsigned char mess[],unsigned char inp[],unsigned char shift)
{
int i;
for(i=0;i<8;i++)
{
mess[i]=(((inp[i]<<shift)&0x80)>>7);
}
}
void setup() {
Serial.begin(9600);
int i,j,p=0,h=0,pos=24;
unsigned char buff[8];
char row=0;
unsigned char temp[32]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
port_initialization();
unsigned char *ch[9]={V,A,R,S,H,I,N,I,space};
unsigned char length[9]={8,8,8,8,8,8,8,8,8};
outportF(0x00);
outportK(0x00);
while(1)
{
for(i=0;i<100;i++)
{
if(h<9)
{
scroll_text(buff,ch[h],p);
}
else{
scroll_text(buff,space,p);
}
display_buffer(buff,temp);
for(j=0;j<8;j++){
row=row+0x01;
shift(row,temp[j]);
shift(row,temp[j+8]);
shift(row,temp[j+16]);
shift(row,temp[j+24]);
latch();
}
row=0x00;
delay(100);
p=p+1;
if(p>length[h]){
p=0;
h=h+1;
}
}
h=0;p=0;
}
}
void loop() {
// put your main code here, to run repeatedly:
}