The STM32F10x core has a system clock base timer, which is a 24-bit down counter. After it is set and enabled, the count value decreases by 1 every time a system clock cycle passes. When the count value decreases to 0, the system time base timer will automatically reload the initial value.
The system time base timer generates an interrupt every 10ms.
Next, we will mainly introduce the library functions.
1. The function of SysTick_CLKSourceConfig is to set the clock source of SysClock. The input parameter is SysTick_CLKSource: SysTick clock source
The possible values of the parameter are: SysTick_CLKSource_HCLK_Div8; SysTick_CLKSource_HCLK. Indicates that the SysTick clock source is the AHB clock divided by 8 and the AHB clock source.
Example: Set the system timer clock to AHB clock.
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
2. The function of Sys_SetReload is to set the SysTick reload value. Its input parameter is a value between 32-bit 1 and 0x00FFFFF. (u32 Reload)
Example: Set the reload value of the system timer to 90000.
SysTick_SetReload(900000);
3. The function of SysTick_CounterCmd is to enable or disable the SysTick counter. Its input parameter is SysTick_Counter: the new state of the SysTick counter
The possible values of the parameter are SysTick_Counter_Disable/Enable/Clear. Indicates disable, enable, clear counter value is 0.
Example: Enable the system timer.
SysTick_CounterCmd(SysTick_Counter_Enable);
4. The function of SysTick_ITconfig function is to enable or disable SysTick interrupt.
5. The function of SysTick_GetCounter is to get the value of SysTick counter.
Example: Get the count value of the system timer. It is a 32-bit value.
u32 SysTickCurrentCounterValue;
SysTickCurrentCounterValue = SysTick_GetCounter();
Previous article:Basic knowledge of STM32 USART
Next article:STM32 system clock initialization program design
- Popular Resources
- Popular amplifiers
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
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
- 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
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- Design of network video monitoring system based on DSP+H.264
- External MOS tube adjustment circuit of power control chip
- Vivado project source code reduction
- 【Repost】Understanding Grating Sensors in One Article
- 500uA-5mA constant current source design
- μSQLite module for MicroPython
- “C2000+TMS570” dual-chip solution
- AD rule setting problem, the spacing between adjacent components is set to 0, but an error is reported when they are close together
- msp430 ultrasonic distance measurement idea
- AC-DC