The picture above is the code for configuring the clock. I will explain it line by line:
SystemInit(); As the name suggests, this is system initialization. I don’t know what is initialized, and I don’t need to know it at present. Just write this sentence;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA
These sentences are a bit long and it makes me dizzy just reading them, but we are not afraid, let's read them one by one, the name of the function RCC_APB2PeriphClockCmd() is a bit strange, it is called enabling or disabling the APB2 peripheral clock (this name is confusing enough), don't worry about it, just copy it directly, and then look at the brackets, RCC_APB2Periph_USART1, this means that the clock of USART1 is the same as that of APB2, and the following ones have the same meaning, connected together with the or symbol, and then add an ENABLE, this enables the pins you want to use, everyone should pay attention, the above code is just something I found at random, in actual use, what can be enabled depends on what you need, and it is best not to enable what you don't need, so as not to cause unnecessary interference and trouble.
GPIO_SetBits(GPIOD, GPIO_Pin_9);
GPIO_ResetBits(GPIOD, GPIO_Pin_9);
The first sentence means to set the GPIOD9 port (we assume that the mode of this port is output mode), and the second sentence means to clear the GPIOD9 port (same assumption). Haha, how about it, simple, this is the basic IO port operation, in this way, you can successfully light up or turn off the specified LED, and a routine is attached below, you can study it slowly.
#include "stm32f10x.h"
//-------------------------------------------GPIO initialization-----------------------------------------//
void GPIO_Configuration(void)
{
}
//--------------------------------------Configure the system clock and enable the clocks of various peripherals---------------------------------//
void RCC_Configuration(void)
{
}
//-----------------------------------Configure all peripherals------------------------------//
void Init_All_Periph(void)
{
}
//----------------------------------------Delay function--------------------------------------------//
void Delay(vu32 nCount)
{
}
//------------------------------------------Main function--------------------------------------------//
int main(void)
{
}
Previous article:stm32 IAR environment printf function call
Next article:GNU ARM Assembly - (I) Introduction
- Popular Resources
- Popular amplifiers
- 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)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
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
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Radio Frequency Identification Technology and Its Application Development Trend
- MSP430F5529 ADC Reference
- Dozens of engineers worked for 5 days, and Alibaba Damo Academy developed an intelligent epidemic robot overnight
- Unboxing video hahaha
- C8051F MCU, how many lines of C language code can an average programmer write in a day?
- The problem of equal length within and between differential pairs
- Tips for selecting inductors in switching power supplies
- Watch! Millimeter wave applied to liquid level measurement design case,,,
- Can anyone share the motor stall detection circuit? Similar to the motor stall detection circuit of door locks and sweepers,
- STM32F10x stepper motor encoder position control CANWeb source program