SYSTICK register initialization
void SysTick_Configuration(void)
{
if (SysTick_Config(SystemCoreClock / 100))
{
while (1);
}
NVIC_SetPriority(SysTick_IRQn, 0x0);
}
SysTick_Config default clock is SysTick_CLKSource_HCLK, so using SysTick_CLKSourceConfig() to select the system clock before this will not change the systick clock
static __INLINE uint32_t SysTick_Config(uint32_t ticks)
{
if (ticks > SysTick_LOAD_RELOAD_Msk) return (1);
SysTick->LOAD = (ticks & SysTick_LOAD_RELOAD_Msk) - 1;
NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_TICKINT_Msk |
SysTick_CTRL_ENABLE_Msk;
return (0);
}
systick interrupt service routine
void SysTick_Handler(void)
{
systime ++;
}
delay program
void delay_ms(unsigned int ms)
{
unsigned int temp;
temp = systime;
while((systime - temp) < ms);
}
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource) is defined in misc.c file
static __INLINE uint32_t SysTick_Config(uint32_t ticks) is defined in core_cm3.h
Previous article:STM32 interrupt (priority, switch total interrupt)
Next article:STM32 complementary output and dead zone insertion
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- EEWORLD University ---- Learn myRIO with me
- Can 868.3MHZ, used as a remote control, go through walls?
- How are diodes classified?
- I want to discuss the direction of work
- MSP430F5438 study notes initialization XT1
- Classic MATLAB simulation model for parameter identification of three-phase asynchronous motor
- Infrared thermometer calibration method
- [Environmental Expert’s Smart Watch] Part 14: APP data visualization!
- CCTV comments on Hongmeng, Huawei announces the latest progress, is Google getting anxious? - Focus, do you want to play with the Hongmeng development board?
- 900 yuan, looking to buy a DE1-SOC, no accessories are required [