Countdown timer with 7-seg display with 8051

Thread Starter

Apok

Joined Jun 12, 2010
2
Hey ppl, i need to make a countdown timer with two 7-seg display, that start count at 30 seconds and ends in 0 seconds. What components i will need ?
And any one got ideias how code will be in C Language?

thx for help
 

Arm_n_Legs

Joined Mar 7, 2007
186
Just hooked up the 2 7 segment displays to the IO ports of the 8051 via transistor array ULN2803, and the switches to any other IO ports.


unsigned char lookUpTable(unsigned char displayNumber);

void 1SecDelay();

void main(){

// Display 30​
digitTenthPort=lookUpTable(3);​
digitUnitPort=lookUpTable(0);​

if (startSwitch==PRESSED){​
for(x=30;x>-1;x--){​
digitTenthPort=lookUpTable(x/10);​
digitUnitPort=lookUpTable(x%10);​
1SecDelay()​
}​
}​
}

}
 
Top