// Display Characters A to E
 
#define Delay 2000
#define Delay2 20
 
void setup() {
  // put your setup code here, to run once:
  volatile long i, j, k ;
  volatile int  ti, n1=0 ,n2=0, Result = 0 ;
  volatile char *dirf, *dirk, *dirA, *dirl  ;
  volatile char *outf,  *outk, *outA, *outl ;
  volatile char n,count=7,x,y,opn = 25, tc, tc2 ;
 
  dirf = 0x30 ; dirk = 0x107 ; dirA = 0x21 ; dirl = 0x10A ;
  outf = 0x31 ; outk = 0x108 ; outA = 0x22 ; outl = 0x10B ;
 
  *dirf = 0xFF ;  *dirk = 0xFF ;  *dirA = 0xFF ; *dirl = 0xFF ;
//char AC[5] = {0x7E, 0xFF, 0x01, 0x80, 0} ;
//char AR[5] = {0xFE, 0xEF, 0x01, 0x01, 0} ;
//char BC[6] = {0x80, 0x01, 0xFE, 0xFE, 0xFE, 0} ;
//char BR[6] = {0x00, 0x89, 0xFE, 0xF7, 0x7F, 0} ;
 
//char Col[5][6], Row[5][6] ;
char Col[][8] ={
      {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0 } ,
      {0X80, 0X40, 0X20, 0X10, 0, 0, 0, 0},      
      {0x80 , 0 ,0 ,0 ,0 ,0, 0, 0},
 
      {0X70, 0X80, 0X70, 0 ,0 ,0, 0, 0 },
      {0X80, 0X40, 0X20, 0X10, 0, 0, 0, 0},
      {0xA8, 0X40, 0X10, 0X04, 0, 0, 0, 0},
      {0X80, 0X40, 0X20, 0X10, 0, 0, 0, 0}
  } ;
char Row[][8] = {
      {0x01, 0xBF, 0xDF, 0xEF, 0xDF, 0xBF, 0x01, 0} ,
      {0X8F, 0X57, 0X57, 0X67, 0, 0, 0, 0},    
      {0x01 ,0 ,0 ,0 ,0 ,0, 0, 0 },
 
      {0XF7, 0X8F, 0X7F ,0 ,0 ,0, 0, 0},
      {0X8F, 0X77, 0X77, 0X8F,0 ,0, 0, 0 },
      {0XF7, 0X0F, 0X0F, 0X0F, 0, 0, 0, 0},
      {0X8F, 0X57, 0X57, 0X67, 0, 0, 0, 0}
} ;
n=0  ;
while(n<count)
{
  for(k=0; k<Delay2; k++)
  {
    i = 0 ;
    while(i<8) // while(Col[n][i] != 0)
    {
     *outf = Col[n][i] ;  *outl = Row[n][i] ; for(j=0; j<Delay; j++);
        *outl = 0xFF ; for(j=0; j<Delay; j++);
      i++ ;
    }
  }
  n++ ;
  if(n>=count)
    n= 0 ;
 
  delay(100) ;
}
 
//Col[1] = {0x80, 0x01, 0xFE, 0xFE, 0xFE, 0} ;
//Row[1] = {0x00, 0x89, 0xFE, 0xF7, 0x7F, 0} ;
 
}
 
void loop() {
  // put your main code here, to run repeatedly:
 
}