What is the sending process of interrupt mode?

Source: Internet
Author: User

Someone has asked this question:

"With the serial port interrupt reception is better understood, as long as the receiving cache receives the data, the flag bit will be placed, and then enter the interrupt service program to read the data in the receiving cache, but in the sending, should be sent after the data sent out after the flag bit will be set (I am the msp430 microcontroller), So what's the point of breaking into an interrupt when the data is sent out? In the end how to send data through the serial interrupt? ”

By reading the code of the STM32 official library, I found the answer.

The basic procedure for interrupting a send is to send an interrupt after each byte is sent, the interrupt handler sends the next byte ... Until the send is complete.

Here are two detail questions to note:

  1. How is the first byte sent? How is the first byte sent out because the first byte was not sent before the interrupt was triggered by the byte completion? This is related to the interrupt at the hardware level of the triggering mode: if it is a level-triggered interrupt, in the interrupt Send function will enable the corresponding interrupt, because the send buffer is empty, the state of the level of the interrupt function will be triggered directly after the interrupt, resulting in the first byte in the interrupt handler function is sent out If it is a level jump trigger interrupt, in order to cause an interrupt, we have to send the first byte "Manually" in the interrupt sending function, thus triggering an interrupted "domino" effect, which sends the subsequent bytes sequentially.
  2. How does it count as "done"? Completion is determined by the number of bytes to be sent as specified by the parameter, but the send reaches the specified number, the interrupt handler function loses the corresponding interrupt, and the Broken "domino" chain stops.

What is the sending process of interrupt mode?

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.