150k views
3 votes
do math for a 130 ms time delay using a Micro-controller with 20-MHZ bus clock if we use 150 E-cycles in total, how many loops do we need? Show detailed process/formula of your calculation.

2 Answers

4 votes

The formula for calculating the number of loops needed to create a desired time delay is:

N = (T * F) / E

where:

  • N is the number of loops
  • T is the desired time delay in milliseconds
  • F is the clock frequency in megahertz
  • E is the number of E-cycles per loop

In this case, we have:

  • T = 130 ms
  • F = 20 MHz
  • E = 150

Plugging these values into the formula, we get:

N = (130 ms * 20 MHz) / 150 = 193 loops

Therefore, we need to execute 193 loops to create a 130 ms time delay.

Here is the detailed process of the calculation:

  1. First, we convert the desired time delay from milliseconds to seconds. To do this, we divide the time delay by 1000: 130 ms / 1000 = 0.13 s
  2. Next, we multiply the time delay in seconds by the clock frequency in megahertz to get the number of clock cycles: 0.13 s * 20 MHz = 2.6 MHz
  3. Finally, we divide the number of clock cycles by the number of E-cycles per loop to get the number of loops: 2.6 MHz / 150 = 193 loops

Therefore, we need to execute 193 loops to create a 130 ms time delay.

User KBN
by
7.5k points
4 votes
20 mhz cs it’s right
User Travis Spencer
by
7.7k points