STM32F4 the data sent by HyperTerminal in the serial experiment, the debugging tool can

Source: Internet
Author: User

I use the Serial wizard to send the data no problem, but the receiving data did not respond.

Serial port to accept the time must be interrupted, you send only by a single flag bit can be judged, but the acceptance of time, you are always stay in while inside, we judge whether to accept the completion, by detecting whether to receive 0x0d, 0x0a continuous to detect whether the end. When this end sequence is detected, the highest bit of the usart_rx_sta is placed to mark the data that has been searched. Then wait for the external function to clear before accepting it for the second time.

Modified: HyperTerminal send settings to wrap as Send end, OK

while (1) {if (usart_rx_sta&0x8000) {   len=usart_rx_sta&0x3fff;//μ?μ?′?′?? Óê?μ?μ?êy? y3¤?èprintf ("\r\n?ú ¢?íμ???? ¢?a:\r\n "); for (t=0;t<len;t++) {usart_senddata (USART1, usart_rx_buf[t]);         ? ò′®?ú1 ¢?íêy? Ywhile (Usart_getflagstatus (USART1,USART_FLAG_TC)!=set);//μè′y ¢?í?áê?} printf ("\r\n\r\n");//2?è??? ddusart_rx_sta=0;} Else{times++;if (times%5000==0) {printf ("\r\nalientekì?? ÷?? Stm32f407?a ¢°? ′®?úêμ?é\r\n ");p rintf ("? yμ?? -xó@alientek\r\n\r\n\r\n ");} if (times%200==0) printf ("?? Ê?è?êy? Y,ò??? 3μ?ü?áê?\r\n ");  if (times%30==0) led0=! Led0;//éá?? Led,ìáê?? Μí3?y?ú?? Dd.delay_ms (ten);   }}


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

STM32F4 the data sent by HyperTerminal is not received in the serial experiment, but the debug tool can

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.