Serial port experiment
1. Before doing any experiment, import the target file into the library file, then import the header file in the main function, and write the path in FWLIB. Of course, the serial port is no exception.
2. After importing the file, the second step is also port initialization (the function of the initialization statement has been explained later)
After initialization is complete, remember to call in the main function
3. Send data using the serial port
Use USART_SendData(USART1,'9'); to send a byte of data, printf(); can also be used to send a string. When using printf, remember to add it to the main() function
#include "stdio.h" header file, otherwise an error will be reported. Of course, the previous knowledge learned in C language can also be applied to the project, because this is originally written in C language
4. There are two ways to send data to the serial port and let the serial port receive and display it on the serial port.
(1) Query method
The first statement is to check whether the data has been sent, if not, continue to wait
The second statement receives data from the serial port USART_ReceiveData (USART1) and assigns it to the variable USART1_RE defined by us.
The third statement is to increase the received data by one and then output USART_SendData()
(2) Interrupt mode
Of course, before writing any method, you need to initialize the port USART_ITConfig(USART1, USART_IT_RXNE, DISABLE); // Enable serial port receive interrupt
Recommended serial port tools
The following is a simpler use
Previous article:stm32 uart clear interrupt timing
Next article:STM32 self-study serial port interrupt mode
Recommended ReadingLatest update time:2024-11-23 07:25
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Great news! The State Council has made a big move: these integrated circuit manufacturers are exempt from income tax for 10 years
- Raspberry Pi Pico Windows Development Environment - Compile and build projects under the command line
- China to launch new policies to support chip manufacturing and design industries
- How to make the falling edge of the stm8 output waveform skew
- [Smart cat-eye design based on STM32F7508-DK] Camera adapter board PCB design
- Design of ultrasonic distance measuring sensor system
- Ask the sensor master
- DSPF28335 source code about SPWM
- Please tell me the function of these options in ALTIUM
- [Xingkong Board Python Programming Learning Main Control Board] System Burning