All Exams Test series for 1 year @ ₹349 only
Question

When TMOD is 10 H, the timer will operate as ____________.

The correct answer is
Mode 2 Timer 0

Timer Modes Explained: The TMOD Register

The TMOD register is a key control register in many microcontrollers, like the 8051 family, used to define how its timers (Timer 0 and Timer 1) will function. It allows you to select between different operating modes and choose whether the timer acts as a timer (counting internal clock pulses) or a counter (counting external events).

The TMOD register is 8 bits wide. It's divided into two halves (nibbles), each controlling one timer:

  • The upper 4 bits (bits 7-4) configure Timer 1.
  • The lower 4 bits (bits 3-0) configure Timer 0.

Within each 4-bit section, the bits have specific roles:

Bit Position (Timer 1 / Timer 0) Bit 7 / 3 Bit 6 / 2 Bit 5 / 1 Bit 4 / 0
Label GATE M1 M0 C/T

  • GATE: This is the Gate Control bit. If GATE is set to 1, the timer only runs when the corresponding external interrupt pin (INT1 for Timer 1, INT0 for Timer 0) is high AND the timer's run bit (TR1 or TR0) is also set. If GATE is 0, the timer runs whenever the TRx bit is set, regardless of the external interrupt pin.
  • M1, M0: These Mode bits select the timer's operational mode. The combinations are:
    • $00$ corresponds to Mode 0 (a 13-bit timer).
    • $01$ corresponds to Mode 1 (a 16-bit timer).
    • $10$ corresponds to Mode 2 (an 8-bit auto-reload timer).
    • $11$ corresponds to Mode 3 (used for split timers).
  • C/T: This bit selects whether the device functions as a Timer or a Counter.
    • If C/T is 0, it operates in Timer Mode, incrementing on each machine cycle.
    • If C/T is 1, it operates in Counter Mode, incrementing whenever the corresponding external input pin (T1 or T0) goes from high to low (a falling edge).

Analyzing the TMOD Value: 10 H

The question states that the TMOD register has a value of $10 H$ (Hexadecimal). To understand how this affects the timers, we convert this value to binary:

$10 H$ = $0001 0000 B$

Let's apply this binary pattern to the TMOD register structure:

  • Timer 1 Configuration (Upper Nibble): The bits are $0001$.
    • GATE1 = 0
    • M11 = 0, M10 = 0 → This selects Mode 0.
    • C/T1 = 1 → This selects Counter Mode.
    So, Timer 1 is configured for Mode 0 Counter.
  • Timer 0 Configuration (Lower Nibble): The bits are $0000$.
    • GATE0 = 0
    • M01 = 0, M00 = 0 → This selects Mode 0.
    • C/T0 = 0 → This selects Timer Mode.
    So, Timer 0 is configured for Mode 0 Timer.

Understanding Timer Mode 2 Operation

The question asks about the timer operation when TMOD is $10 H$. Based on the provided correct answer, the focus is on Timer 0 operating in Mode 2.

Mode 2: 8-bit Auto-Reload

Mode 2 is a special mode designed for generating periodic events efficiently. Here's how it works:

  • It uses an 8-bit timer (TLx register).
  • The corresponding upper 8-bit register (THx) stores a preset value.
  • When the 8-bit TLx register counts up and overflows (goes from $1111 1111 B$ to $0000 0000 B$), it is automatically reloaded with the value stored in THx.
  • This auto-reload feature makes it ideal for tasks like setting the baud rate for serial communication or generating regular interrupts without requiring software intervention for reloading.

In the context of the question and its options, the intended setup when TMOD is $10 H$ points towards Timer 0 operating in Mode 2.

Was this answer helpful?

Important Questions from Microprocessors

  1. What is the value in AL and CF after the following instruction in 8086 is executed?
    MOV AL, 8EH
    MOV CL, 02H
    SAR AL, CL
  2. What is the content in R1, after the following instructions are executed?
    CLR C
    MOV A,#4CH
    SUBB A,#6EH
    JNC NEXT
    CPL A
    INC A
    NEXT: MOV R1, A
  3. The Assembler directive in 8086 which is used to tell the assembler that the names or labels following the directive are in some other assembly module is, ____________.
  4. The magnetic vector potential of an electromagnetic system is given by $  \vec{A}=(y \cos ax)  \vec{a_x} + (y+e^x)   \vec{a_z}$. The magnitude of the magnetic flux density at the origin is

  5. The location of flags in 8086 flag register in ascending order is
    A. CY
    B. T
    C. D
    D. Z
    E. O
    Choose the correct answer from the options given below:

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App