Question

Write a routine to implement a time delay of approximately 250 ms using TMRO. Assume an instruction cycle of 1
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :- The time delay value is 250 us. Instruction cycle is 1us. Hence the number of timer count required is 250.
Since timer overflows when it goes to FFFFH, hence the timer must be loaded with value 250 count less than FFFFH. So the timer load value is = (0xFFFF - (hex of 250)) = 0xFFFF - 0xFA = 0xFF05. The delay subroutine can be written as-

Delay250us: ; subroutine name

MOV TMOD. #01 ; set timer0 mode 1 i.e. 16-bit timer

MOV TL0, #05H ; load timer count value, lower 8-bit

MOV TH0, #0FFH ; load timer count value, upper 8-bit

SETB TR0 ; start the timer

Here : JNB TF0, Here ; wait untill timer overflows

CLR TR0 ; stop the timer after it finishes the count

CLR TF0 ; clear the interrupt

RET ; return from the subroutine

Add a comment
Know the answer?
Add Answer to:
Write a routine to implement a time delay of approximately 250 ms using TMRO. Assume an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT