// 1 to 9 A to D dispaly 10-11-22
void setup() {
// put your setup code here, to run once:
volatile char *dirf,*dirk,*dira,*dirc;
volatile char *outf,*outa,*outc;
volatile char *ink;
volatile long i,j,x,y;
volatile long a[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
volatile long alp[]={0x77,0x7f,0x39,0x5E,0x79,0x71,0x6F,0x76,0x06,0x1e,0x38,0x73,0x67,0x3E};
dirc = 0x27; dirf = 0x30; outf = 0x31; dirk = 0x107; dira = 0x21;
*dirc = 0x0f; *dirf = 0x0f; *dirk = 0x00; *dira = 0xff;
outa = 0x22; outc = 0x28;
ink = 0x106;
while(1)
{
for(i=0;i<4;i++)
{
*outf = 1 << i;
x = *ink;
if(x != 0)
{
if(*outf == 1 && x == 1)
{
*outa=a[1];
}
if(*outf == 1 && x == 2)
{
*outa=a[2];
}
if(*outf == 1 && x == 4)
{
*outa=a[3];
}
if(*outf == 2 && x == 1)
{
*outa=a[4];
}
if(*outf == 2 && x == 2)
{
*outa=a[5];
}
if(*outf == 2 && x == 4)
{
*outa=a[6];
}
if(*outf == 4 && x == 1)
{
*outa=a[7];
}
if(*outf == 4 && x == 2)
{
*outa=a[8];
}
if(*outf == 4 && x == 4)
{
*outa=a[9];
}
}
}
}
}
void loop() {
// put your main code here, to run repeatedly:
}