What value do we need to load the timer’s register if we want to have a time delay of 5 ms (milliseconds) using timer 0, T0 in mode 1? Consider crystal frequency to be 12 MHz.1 pointTH0 = CEH, TL0 = 70HTL0 = ECH, TH0 = 78Hnone of theseTH0 = ECH, TL0 = 78H
Question
What value do we need to load the timer’s register if we want to have a time delay of 5 ms (milliseconds) using timer 0, T0 in mode 1? Consider crystal frequency to be 12 MHz.1 pointTH0 = CEH, TL0 = 70HTL0 = ECH, TH0 = 78Hnone of theseTH0 = ECH, TL0 = 78H
Solution
To solve this problem, we first need to understand the timer configuration and how it works in the microcontroller.
In mode 1, Timer 0 (T0) is a 16-bit timer, which means it can count from 0x0000 to 0xFFFF (65535 in decimal).
The time delay generated by the timer is determined by the crystal frequency. In this case, the crystal frequency is 12 MHz.
The time for one machine cycle = 1 / (Crystal Frequency / 12) = 1 / (12 MHz / 12) = 1 / 1 MHz = 1 µs (microsecond)
So, the timer will increment by 1 every 1 µs.
If we want a delay of 5 ms (or 5000 µs), the timer will need to count to 5000.
However, since the timer can only count to 65535, we need to preload the timer with a value that will cause it to overflow after it has counted to 5000.
This preload value is calculated as follows:
Preload Value = Timer Max Value - Required Count + 1 = 65535 - 5000 + 1 = 60536
This value needs to be loaded into the timer's register as a 16-bit value. In hexadecimal, 60536 is 0xEC78.
Therefore, TH0 should be loaded with 0xEC and TL0 should be loaded with
Similar Questions
f the crystal frequency is 4.5 MHz, determine the time for setting the timer flag for mode 1 if TH0 starts at 00H.1 point12 ms2 ms174.78 ms50 ms
The delay produced by 8051 Mode 1 timer with TH=20 and TL=0F, crystal frequency 11.0592MHz is*4 pointsA) 5.183 millisecondsB) 62.201 millisecondsC) 60.201 millisecondsD) 52.38 milliseconds
What is the resolution of Timer/Counter0 when the CPU frequency is set to 16MHz and the following code is used for configuration of prescaler:TCCR0B |= (1<<CS02);Give your answer in microseconds (us).
Mention the roll over value (in hex and decimal) of the timer for each of the following cases:1. Timer 0 Normal mode2. Timer 1 normal mode
In model 1, 8051 operated with 11.0592MHz crystal oscillator. The clock frequency to set timer 1 baud rate is ________.1 pointA) 28.8MHzB) 28.8KHzC) 345.6KHzD) 921.6KHz
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.