//06 Initially display 0.
//When switch 1 is pressed every time increment by 1
void setup() {
// put your setup code here, to run once:
direction();
}
void loop() {
// put your main code here, to run repeatedly:
code();
}
//************************
void delay_()
{
volatile long i;
for(i=0;i<500000;i++);
}
void direction()
{
volatile char *dirf,*dirk,*dira;
dirf = 0x30; dirk = 0x107;dira =0x21;
*dirf = 0xFF; dirk = 0xFE;*dira = 0x01;
}
void code()
{
volatile char *outf,*ink,*outa,x;
outf = 0x31; ink =0x106; outa = 0X22;
x =0x00;
*outf = 0x3f;
while(1){
*outa = 0x00;
if(*ink==1) {x= x+1;delay_();}
else { x = x;*outa = 0x01;}
if(x == 0x01) *outf = 0x06;
if(x == 0x02) *outf = 0x5B;
if(x == 0x03) *outf = 0x4F;
if(x == 0x04) *outf = 0x66;
if(x == 0x05) *outf = 0x6D;
if(x == 0x06) *outf = 0X7D;
if(x == 0x07) *outf = 0x07;
if(x == 0x08) *outf = 0x7F;
if(x == 0x09) *outf = 0x6F;
if(x>9) {*outf = 0x3F; x = 0;}
else *outf = *outf;
}
}