Countdown timer with 7-seg display with 8051

Discussion in 'Embedded Systems and Microcontrollers' started by Apok, Jun 12, 2010.

  1. Apok

    Thread Starter New Member

    Jun 12, 2010
    2
    0
    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
     
  2. Arm_n_Legs

    Active Member

    Mar 7, 2007
    183
    10
    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()​
    }​
    }​
    }

    }
     
Loading...