Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get a valid string in stm32

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to get valid strings in stm32. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Void USART2_IRQHandler () {if (USART_GetITStatus (USART2,USART_IT_RXNE)! = RESET) / / interrupt generation {USART_ClearITPendingBit (USART2,USART_IT_RXNE); / / clear the interrupt flag Uart2_ buffer [Uart2 _ Rx] = USART_ReceiveData (USART2); / / store data in the buffer array Uart2_Rx++ Uart2_Rx & = 0xFF;} if (Uart2_ buffer [Uart2 _ Rx-1] = = 0x5A) / / if you received 0x5A, the following is the valid data Uart2_Tx = Uart2_Rx-1 If ((Uart2_ buffer [Uart2 _ Tx] = = 0x5A) & & (Uart2_ buffer [Uart2 _ Rx-1] = = 0xA5)) / / the tail {Uart2_Len = Uart2_Rx-1- Uart2_Tx; / / length Uart2_Sta=1 is detected when the header is detected / / flag bit} if (USART_GetFlagStatus (USART2,USART_FLAG_ORE) = = SET) / / overflow {USART_ClearFlag (USART2,USART_FLAG_ORE); / / read SR USART_ReceiveData (USART2) / / read DR}} main.c# if (Uart2_Sta) / / data frame received {for (tx2=0;tx2)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report