HI all, I'm a newbie here. I need your help, does one of you know how is the code to countdown from 99 with 7 segment and atmel 89s51 or 89s52?
plz help me soon..

## All 8 Replies

I'm sure some of us do, but we're not likely to just give it to you just because you ask.
See the intro threads, we don't give free homework.
Show us what you've managed so far, and then we'll help you with the next step.

Why would you want to program it in assembly? AVR-studio can compile C for the 89s51. So the code would look like:

``````char i;
for (i=99; i >0; i--)
{
//write 'i' to 7-seg
}``````

Without knowing how you connected everything, that's all I can tell you

Create a variable for units and a variable for tens.
Decrement the units variable, then pass each to a subroutine which checks its value and sends out the particular code. If the units variable is zero, it becomes nine and decrement the tens variable.

Meh, methinks you're wasting your fingers, since they've probably gone looking for free food elsewhere rather than actually risk learning something.

Connect 2 seven segment displays on P0 & P2.
Initialize the R0 & R1 registers to 0.
Increment count for every second.
Use this circuit for Count down timer with AT89C2051

For More details visit my website

The AT89C2051's output drops to 2.4V when it's output high is only 80uA. The base current of Q2 will never reach 1.9mA. The chip sinks 20mA so PNP transistors should be used.

Thats a Good point, because 8051 micros drive the load only to ground.
In my circuit i have given pull up resistors for the pins which goes to the base of the transistors. So that the transistor works fine for me.
Anyway thanks for your advice, i will implement it and come back.

Prepare a look up table for 7 segment display for numbers 0 to 9.. make use of two 7-seg LED's and , get the count number to be displayed , and display the digits with help of look up table...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.