//09 Initially display 9
//When switch 1 is pressed start displaying 9 to 0
//Continuously. When switch 2 is pressed stop display.
void setup() {
// put your setup code here, to run once:
direction();
}
void loop() {
// put your main code here, to run repeatedly:
code();
}
//****************************************
void direction()
{
volatile char *dirf,*dirk,*dira;
dirf = 0x30; dirk = 0x107; dira = 0x21;
*dirf = 0xFF; *dirk = 0x00; *dira = 0x01;
}
void delay_()
{
volatile long i;
for(i=0;i<300000;i++);
}
void code()
{
volatile char *ink,*outa,x=0;
ink = 0x106; outa = 0x20;
while(1)
{
*outa = 0x01;
if((*ink & 0x01) == 0x01) {*outa = 0x00;start();delay_();}
else if((*ink & 0x02)== 0x02) {*outa = 0x00;stop(); delay_();}
else {*outa = 0x01;off();}
}
}
void start()
{
volatile char *outf;
outf = 0x31;
*outf = 0x6F;delay_();
*outf = 0x7F;delay_();
*outf = 0x07;delay_();
*outf = 0x7D;delay_();
*outf = 0x6D;delay_();
*outf = 0x66;delay_();
*outf = 0x4F;delay_();
*outf = 0x5B;delay_();
*outf = 0x06;delay_();
*outf = 0x3F;delay_();
}
void stop()
{
volatile char *outf;
outf = 0x31;
*outf = 0x80;delay_();
}
void off()
{
volatile char *outf;
outf = 0x31;
*outf = 0x6F;
}