RFQ/BOM 0 Sign In / Register

Select Your Location

user image

How does the data sent in the serial port interrupt program enter the interrupt?

Hardware design
November 19, 2020 by Jasmine 1469

Sending interrupt is executed after MOV SBUF,A is sent. After sending, ti is set to 1, and then the interrupt can be entered. But I saw an example in the book, sending multiple bytes of data in the interrupt, and exiting after sending one byte Interrupt, there is no MOV SBUF, A instruction after exiting, why enter the interrupt to send data again?

All Comments

user image

Laila Posted on November 19, 2020

After entering the interrupt, send another byte of data, and of course it will enter the interrupt again after exiting the interrupt.

0
  • Jasmine

    Jasmine Posted on November 19, 2020

    The above is the interrupt sending program. The first thing I don’t understand is how to enter the sending interrupt if there is no mov sbuf instruction in the main program. After entering the interrupt, the TI generated by the mov sbuf inside the interrupt has been cleared. After sending a byte, exit , How to send the following bytes again?

  • You need to log in to reply. Sign In | Register

user image

Laila Posted on November 19, 2020

There is indeed a problem with this code, there may be a problem with the compilation


POP A should not be compiled, it should be written as POP ACC


R0, R4 are not initialized, and the other should not clear TI, otherwise the interrupt cannot be entered again


This should not be the official code.

0
user image

Esther Posted on November 19, 2020

I haven't used the sending method of entering interrupt much. Usually, the sending is performed sequentially from the outside. Here you have a conceptual error. After the serial port sends data, TI is set to 1, and the hardware enters the interrupt according to this condition. This includes the setting of TI. All are done automatically by hardware, so you don't need to bother after executing MOV SBUF,A.

There is a problem with this routine. Use interrupt to send data, then there should be no code to judge whether TI is set to 1 in the interrupt, the WAIT part in the routine should be removed, and there should be a judgment process to judge whether the data packet is sent completely, judge After it is established, some flags should be set to avoid unlimited sending of data.

0

Write an answer

You need to log in to reply. Sign In | Register