This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how do i give a 0.1 second delay in 89c51 assembley

hi!i want to know how to to give a delay of 0.1 second in keil assembley of 8051 microcontroller, using timers. it would be great if any of you could help, esp with the code. i can give small delays easily but this is somewhat large....i have a project due and i am stuck at this.
thankyou in advance:)

Parents
  • A stopwatch have a fast hand that runs around the face many times. So you have a slower hand that counts number of times the fast hand have gone around.

    Same with timers. The timer ticks comes quickly. So just as Erik said - inside the ISR you count up a variable to know how many interrupts you have had. With a 8-bit counter, you can count 0..255 interrupts. With a 16-bit counter, you can count 0..65535 interrupts. So no problem at all to measure times thousands or millions or quadrillions of times longer than the timer interrupt period.

    A normal digital watch can only count 0..59 for seconds. But it still manages to handle time longer than that. Every overflow counts as a minute. Every minute overflow counts as an hour. Every hour overflow counts as a day.

    So back to you - why do you think you need a loop?

Reply
  • A stopwatch have a fast hand that runs around the face many times. So you have a slower hand that counts number of times the fast hand have gone around.

    Same with timers. The timer ticks comes quickly. So just as Erik said - inside the ISR you count up a variable to know how many interrupts you have had. With a 8-bit counter, you can count 0..255 interrupts. With a 16-bit counter, you can count 0..65535 interrupts. So no problem at all to measure times thousands or millions or quadrillions of times longer than the timer interrupt period.

    A normal digital watch can only count 0..59 for seconds. But it still manages to handle time longer than that. Every overflow counts as a minute. Every minute overflow counts as an hour. Every hour overflow counts as a day.

    So back to you - why do you think you need a loop?

Children