void delay();
void setup() {
// put your setup code here, to run once:
volatile char *dir_f,*dir_k,*dir_a;
dir_f=0x30;
dir_k=0x107;
dir_a=0x21;
*dir_f=0xff;
*dir_k=0x00;
*dir_a=0x00;
}
void loop() {
// put your main code here, to run repeatedly:
volatile char *out_f,*in_k,*in_a;
volatile char x,y;
out_f=0x31;
in_k=0x106;
in_a=0x20;
y=*in_a;
x=*in_k;
if((x & 0x01) == 0x01)
{
*out_f=0x3f;//0
delay();
}
if((x & 0x02) == 0x02)
{
*out_f=0x06;//1
delay();
}
if((x & 0x04) == 0x04)
{
*out_f=0x5b;//2
delay();
}
if((x & 0x08) == 0x08)
{
*out_f=0x4f;//3
delay();
}
if((x & 0x10) == 0x10)
{
*out_f=0x66;//4
delay();
}
if((x & 0x20) == 0x20)
{
*out_f=0x6D;//5
delay();
}
if((x & 0x40) == 0x40)
{
*out_f=0x7d;//6
delay();
}
if((x & 0x80) == 0x80)
{
*out_f=0x07;//7
delay();
}
if((y & 0x01) == 0x01)
{
*out_f=0x7f;//8
delay();
}
if((y & 0x02) == 0x02)
{
*out_f=0x6f;//9
delay();
}
}
void delay()
{
volatile long i;
for(i=0;i<100000;i++);
}