#include"ECEN.h"
void setup() {
volatile int Number1=0,sec=60,Switch=0,counter=0,Number2=0;// Declaration of Required Variables
volatile int outputmodeF=0xff,outputmodeK=0x0f,outputmodeA=0x00,outputmodeC=0x00; // Initialaization of input and output modes
init_portF(outputmodeF);// Initialization of Port F
init_portK(outputmodeK); // Initialization of Port K
init_portA(outputmodeA); // Initialization of Port A
init_portC(outputmodeC); // Initialization of Port C
while(1)
{
Switch=ReadSwitch(); // Reading Switch
if(Switch==1 || Switch==0 || Switch==2 || Switch==3 || Switch==4 || Switch==5 || Switch==6 || Switch==7 || Switch==8 || Switch==9)
{
Number1=10*Number1+Switch; // Number
counter++; // Switch count
}
if(counter==1 || counter==2 || counter==3 || counter==4)// when counter is equals 1 or 2 or 3 or 4 then enter the "if"
{
Display4(Number1); // Displaying Number
}
else if(counter==5) // when switch at 5th time , counter set to 1
{
counter=1; //counter set to 1
Number2=Number1; // copying number1 to Number2
Number1=0; // number set to 0;
Number1=Number2 % 10; // copying last digit to number1
Number2=0;
Display4(Number1);// Displaying Number
}
}
}
void loop() {
}