We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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:)
you can use a bigger crystal and you go slower and add lots of nops.
if this is not tongue in cheek, his is the winner of the award for the silliest answer of the year.
the right answer: run a counter in the timer ISR.
Erik
You're killing Gates...
I can sucessfully measure a day. It's the time from sunrise to the next sunrise. Or from sunset to the next sunset. This works fine; I have tested this several times. But now I need to measure a week. How can I do this. Please help. ;-)
So what is the exact purpose of this application?
If that's something of just an experiment, it's OK.
But if your application must keep time going (say, for months or years or to the end of the world), you should take an RTC (Real Time Clock) rather than do it by timer within microcontrollers. Compensation for temperature, variation and aging is totally unavailable in this case.
but its specified that 11.0592MHz should be used...thankyou very much, i just got it figured out.thanks anyways:)
thanks.but i did it anyways:)
haahaha, you are right:p btw, this is not my real name. your gates is just fine, rest assured:)
hahaha, good point. what i wanted was NOT to use this approach of looping, but i guess there is no other alternative, so i have done it:) thankyou:)
i want to make a watch that can measure time upto one tenth os a second, and i have just recently studied timers. mov tmod, #01 mov th0, #76 mov tl0, #0 setb tr0 k:jnb tf0, k clr tr0 clr tf0 this is my code and it it works just fine:) thankyou so much:)
11.0592 is specified...
THREAD CLOSED PEOPLE, THANKS:):)
what i wanted was NOT to use this approach of looping, but i guess there is no other alternative, so i have done it
male cow manure and fatty red sausage, the 'alternative' was stated in the 3rd post in the thread.
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?
dear mr idiot. if i was that advanced in the subject, i would not have asked such a basic question. sometimes, use your brain. helps your mental health.