Determine the values of timer TIM7 prescaler (PSC) and autoreload (ARR) registers so set timer overflow period to 100 ms, if timer clock frequency is 80 MHz:

To calculate the values of the prescaler (PSC) and autoreload (ARR) registers to set the timer overflow period to 100 ms with a timer clock frequency of 80 MHz, we can use the formula:

Timer Period = ((PSC + 1) * (ARR + 1)) / Timer Clock Frequency

In this case, the timer period is 100 ms (0.1 seconds) and the timer clock frequency is 80 MHz (80,000,000 Hz), so we can substitute these values into the formula:

0.1 = ((PSC + 1) * (ARR + 1)) / 80,000,000

Simplifying the equation, we get:

0.1 * 80,000,000 = (PSC + 1) * (ARR + 1)
8,000,000 = (PSC + 1) * (ARR + 1)

Now, we need to find a suitable combination of PSC and ARR values that satisfies this equation. One possible solution is to set PSC = 7999 and ARR = 999, as follows:

(7999 + 1) * (999 + 1) = 8,000,000
8000 * 1000 = 8,000,000
8,000,000 = 8,000,000

Therefore, setting the prescaler (PSC) register to 7999 and the autoreload (ARR) register to 999 will give a timer overflow period of 100 ms with a timer clock frequency of 80 MHz.

use this formula:

Toverflow = (ARR + 1) · TC

Given the formula:

Toverflow = (ARR + 1) · TC

Given that the timer overflow period is 100 ms (0.1 seconds) and the timer clock frequency is 80 MHz, we can rearrange the formula to solve for ARR:

ARR = (Toverflow / TC) - 1
ARR = (0.1 / (1 / 80,000,000)) - 1
ARR = (0.1 * 80,000,000) - 1
ARR = 8,000,000 - 1
ARR = 7,999

Now that we have calculated the ARR value, we can use the formula given in the previous response to solve for the prescaler (PSC):

PSC = (Toverflow / (ARR + 1)) - 1
PSC = (0.1 / (7,999 + 1)) - 1
PSC = (0.1 / 8,000) - 1
PSC = 0.0000125 - 1
PSC = -0.9999875

Since the prescaler value should be a positive integer, we need to round up to the nearest whole number:

PSC = 0

Therefore, to set the timer overflow period to 100 ms with a timer clock frequency of 80 MHz, the prescaler (PSC) register should be set to 0 and the autoreload (ARR) register should be set to 7,999.