Attached here is the receive interrupt source code
#ifdef _RAISONANCE_
void USART_RX_IRQHandler(void) interrupt 28
#endif
uint8_t cnt_USART;
#ifdef _IAR_SYSTEMS_
#pragma vector=30
__interrupt void USART_RX_IRQHandler(void)
#endif
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
USART_ClearITPendingBit (); // Clear interrupt flag
if(!USART_GetFlagStatus (USART_FLAG_RXNE)) //Wait for reception to complete
{
p_rxbuf[cnt_USART++] = USART_ReceiveData8(); //Receive data
if(cnt_USART == 0x0B)
cnt_USART = 0xFF;
}
// USART_RendCmd(p_rxbuf); //Receive 11 bytes serial port command
}
cnt_USART is a global variable. Since only 1 byte is received each time, the main program should perform an appropriate delay to wait for the data in the buffer to be read.
while(cnt_USART!=0xFF)
{
if(mark_1ms >100)
break;
}
Perform appropriate delay in the function to wait, mark_1ms here uses TIM2 for delay, and you can also perform empty function delay in the main function.
Previous article:SPI bus detailed notes
Next article:Solve the problem that stm8 will be stuck in serial port interruption
- 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
- Confirm that your personal information is correct
- The battery management chip used is Zhongying's SH39F004! Why is the filtering starting from the sixth battery not filtering the GND?...
- KiCad to other EDA conversion
- 【Silicon Labs Development Kit Review】– Joy & Unboxing
- [Raspberry Pi 3B+ Review] Burning System & Locking Static IP & SSH Login & SFTP Login
- STM32F407VET6 Another question about PWM wave
- Want to exchange, use TI LM3S8962EVALUATION KIT for an NXP Rapid IoT
- Ultra-wideband application analysis collection
- [TI star product limited time purchase] + CC2640R2 is quite attractive at this price!
- The difference between radio remote control and infrared remote control