void setup()
{
volatile char *dirf,*outf;
volatile char *dirk,*ink;
dirf=0x30; outf=0x31;
dirk=0x107; ink=0x106;
*dirf=0xFF; *ink=0x00;
volatile char switches;
volatile long arr[]={63,6,91,79,102,109,125,7,127,111};
volatile long i,j,k,stopbit=1;
loop: while(1)
{
if(stopbit==0) // to stop display
{
*outf=0;// turn on off display
break;
}
*outf=arr[0];// first display zero
switches=*ink;
if((switches & 1) == 1)
{
for(volatile long n=0;n<=50000;n++);//delay for debuncing
while(1)
{
for(j=0;j<=9;j++)
{
switches=*ink;
if((switches & 2) == 2)//to stop the display
{
stopbit=0;
for(volatile long n=0;n<=50000;n++);
goto loop;
}
*outf=arr[j];// to display the numbers
for(k=0;k<=200000;k++);// delay
}
}
}
}
}
void loop()
{
}