Machine-translated by Google. Questions are authored in English.
Top

Discussion

What steps are followed when we need to turn on any timer ?

  • A.load the count, start the timer, keep monitoring it, stop the timer
  • B.load the TMOD register, load the count, start the timer, keep monitoring it, stop the timer
  • C.load the TMOD register, start the timer, load the count, keep monitoring it, stop the timer
  • D.load the count, divide TCON by 2, start the timer, keep monitoring it, stop the timer

Answer: B

The steps are: load the TMOD register, load the count, start the timer, keep monitoring it, stop the timer.

On the 8051, a timer is used as follows:

  1. Load TMOD to select the timer, its mode (for example 16-bit mode 1) and whether it counts as a timer or counter.
  2. Load the initial count into TH and TL.
  3. Start the timer by setting TR0 or TR1 in TCON.
  4. Monitor the overflow flag TF0 or TF1 (or use the interrupt).
  5. Stop the timer by clearing TR, and clear the TF flag.

Leaving out TMOD leaves the mode undefined. Starting the timer before loading the count makes it count from the wrong value. 'Divide TCON by 2' is not an operation; TCON holds control bits, not a count.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.