#include "stm32_lib/inc/stm32f0xx_misc.h"
#include "stm32_lib/inc/stm32f0xx_rcc.h"
int main(void){
//Configure the initial value, the system timer is a countdown timer, minus 1
//Note: Although the parameter type of this function is uinit32_t, the actual maximum value is 16777215, which is 2^24
SysTick_Config(SystemCoreClock/10);
while(1);
}
//Interrupt function
void SysTick_Handler(void){
//Do what you want here
}
System timer, it's that simple! The clock is the system clock, just configure the countdown number.
Please note that the effective value of the counter is 24 bits. If you set it to SystemCoreClock/2, you will be in trouble!
看图 if (ticks > SysTick_LOAD_RELOAD_Msk) return (1);
What is SysTick_LOAD_RELOAD_Msk? 0xFFFFFFUL << 0. Got it!
By the way, interrupts do not need to be configured by the user because the system has configured them for you.
What's so good about this system clock?
Personally, I only think of using it for flashing various LEDs. I throw the flashing task to SysTick_Handler, and the main program can do whatever it wants.
Previous article:STM32F030F4P6 Flash capacity problem
Next article:stm32f030c8t6 MCU enters low power mode
Recommended ReadingLatest update time:2024-11-15 16:36
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
- MSPEXP432P401RLaunchPad Development Kit
- lm317 always breaks down
- [BearPi-HM Nano] UART test
- Application of Hall sensor and current ripple technology in electric window anti-pinch
- There is no one to teach me how to learn FPGA. Can I learn it just by watching tutorials?
- Brushed DC and brushless DC driver chips
- Analysis of the application of NTC thermistor in power circuit
- Use LabVIEW to remotely control the Raspberry Pi via WiFi~
- DC-DC boost to 5V abnormal
- Analysis of the working principles of seven triode collector DC circuits 6