An MCU programmer wants to develop a real time chronometer, which can count to 1 0 0
Fantastic news! We've Found the answer you've been seeking!
Question:
An MCU programmer wants to develop a real time chronometer, which can count to minutes,
on STMF by using a timer peripheral TIM TIM has a bit TIMxPSC register, a bit
TIMxARR register, and a bit TIMxCNT register. TIM is connected to the APB bus. The source
clock of the timer is clock of the bus. Assume that all required settings and variable declarations are
done and the code will be executed after resetting.
i APB bus has arranged to have a clock frequency of MHz Analyze the below code and
determine the values, those should be written to related registers. Show your calculations and
justify your results. Determine the period of the timer and the time it takes to create an interrupt request.
TIMHandleTypeDef htim;
int mainvoid
TIMPSC;
TIMARR;
HALTIMBaseStartIT&htim;
Interrupt handler void TIMIRQHandlervoid
HALTIMIRQHandler&htim; clears IRQ
splitsecond splitsecond ; salise
if splitsecond
splitsecond ;
second second;
if second
second ;
minute minute ;
if minute
minute ;
Interrupt handler void EXTIIRQHandlervoid
HALGPIOEXTIIRQHandlerGPIOPIN; clears IRQ
iTIMxCNT;
Posted Date: