void count(void); // count the digits from 00 to 99
volatile *dirf,*dirk,*dira,*outf,*outk,*ina,x;
volatile int arr[]={0x3F,//0
0x06,//1
0x5B,//2
0x4F,//3
0x66,//4
0x6D,//5
0x7D,//6
0x07,//7
0x7F,//8
0x67,//9
};
void setup() {
dirf=0x30,dirk=0x107,dira=0x21;
outf=0x31,outk=0x108,ina=0x20;
*dirf=0xff,*dirk=0x0f,*dira=0x00;
volatile char Digit2=0,Digit1=0,inputA=0;
while(1){
inputA=*ina;
if(inputA==1)
{
Digit2=Digit2+1;
// delay(318);
}
if(Digit2==10)
{
Digit1++;
if(Digit1==10)
{
Digit1=0;
}
Digit2=0;
}
*outk=0x01;
*outf=arr[Digit2];
*outf=0x00;
// *outk=0x03;
//delay(1000);
*outk=0x02;
*outf=arr[Digit1];
*outf=0x00;
// *outk=0x03;
// delay(15);
}
}
void loop() {
}
void count()
{
dirf=0x30,dirk=0x107,dira=0x21;
outf=0x31,outk=0x108,ina=0x20;
*dirf=0xff,*dirk=0x0f,*dira=0x00;
volatile char Digit2=0,Digit1=0,inputA=0;
inputA=*ina;
delay(1000);
if(inputA==1)
{
Digit2=Digit2+1;
delay(225);
}
if(Digit2==10)
{
Digit1++;
if(Digit1==10)
{
Digit1=0;
}
Digit2=0;
}
*outk=0x01;
*outf=arr[Digit2];
*outf=0x00;
*outk=0x03;
//delay(1000);
*outk=0x02;
*outf=arr[Digit1];
*outf=0x00;
*outk=0x03;
delay(100);
}