#define DELAY 500000
void setup() {
// put your setup code here, to run once:
volatile char *dirf,*dirk;
dirf=0x30; dirk=0x107;
*dirf=0xff; *dirk=0x00;
}
void loop() {
// put your main code here, to run repeatedly:
volatile char *outf,*ink,x;
volatile long i;
outf=0x31; ink=0x106;
i=0;
while(1){
x=*ink;
if((x&0xff)==0x40){
*outf=0x3f;
for(i=0;i<DELAY;i++);
*outf=0x06;
for(i=0;i<DELAY;i++);
*outf=0x5b;
for(i=0;i<DELAY;i++);
*outf=0x4f;
for(i=0;i<DELAY;i++);
*outf=0x66;
for(i=0;i<DELAY;i++);
*outf=0x6d;
for(i=0;i<DELAY;i++);
*outf=0x7d;
for(i=0;i<DELAY;i++);
*outf=0x47;
for(i=0;i<DELAY;i++);
*outf=0x7f;
for(i=0;i<DELAY;i++);
*outf=0x6f;
for(i=0;i<DELAY;i++);
*outf=0x7f;
for(i=0;i<DELAY;i++);
*outf=0x47;
for(i=0;i<DELAY;i++);
*outf=0x7d;
for(i=0;i<DELAY;i++);
*outf=0x6d;
for(i=0;i<DELAY;i++);
*outf=0x66;
for(i=0;i<DELAY;i++);
*outf=0x4f;
for(i=0;i<DELAY;i++);
*outf=0x5b;
for(i=0;i<DELAY;i++);
*outf=0x06;
for(i=0;i<DELAY;i++);
*outf=0x3f;
for(i=0;i<DELAY;i++);
}
else
*outf=0x00;
}
}