void delay();
void setup()
{
volatile char *dir_f,*dir_k;
volatile char *out_f,*in_k;
volatile char x;
volatile long i;
dir_f=0x30;dir_k=107;
*dir_f=0xff;*dir_k=0x00;
out_f=0x31;in_k=0x106;
while(1)
{
x=*in_k;
if((x & 0x01)==0x01 || (x & 0x02)==0x02 || (x & 0x04)==0x04 || (x & 0x08)==0x08 || (x & 0x10)==0x10 || (x & 0x20)==0x20 || (x & 0x40)==0x40 || (x & 0x80)==0x80)
{
*out_f=0x01;
delay();
*out_f=0x00;
delay();
*out_f=0x02;
delay();
*out_f=0x00;
delay();
*out_f=0x04;
delay();
*out_f=0x00;
delay();
*out_f=0x08;
delay();
*out_f=0x00;
delay();
*out_f=0x10;
delay();
*out_f=0x00;
delay();
*out_f=0x20;
delay();
*out_f=0x00;
delay();
*out_f=0x40;
delay();
*out_f=0x00;
delay();
*out_f=0x80;
delay();
*out_f=0x00;
delay();
}
}
}
void delay()
{
volatile long i;
for(i=0;i<500000;i++);
}