Tool/software: TI C/C++ Compiler
question > How does a 100Hz interrupt calculate SysTick?
The contents are as follows.
#define TICKS_PER_SECOND 100
// Set the system clock to run at 50MHz from the PLL.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
// Configure SysTick for a 100Hz interrupt.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
(Refer to SW-TM4C-DRL-UG-2.1.4.178 file )
28.2.2.8 SysTickPeriodSet
Sets the period of the SysTick counter.
Prototype:
void
SysTickPeriodSet(uint32_t ui32Period)
Parameters:
ui32Period is the number of clock ticks in each period of the SysTick counter and must be
between 1 and 16, 777, 216, inclusive.
Description:
This function sets the rate at which the SysTick counter wraps, which equates to the number
of processor clocks between interrupts.
Note:
Calling this function does not cause the SysTick counter to reload immediately. If an immediate
reload is required, the NVIC_ST_CURRENT register must be written. Any write to this register
clears the SysTick counter to 0 and causes a reload with the ui32Period supplied here on the
next clock after SysTick is enabled.
Returns:
None.