RFQ/BOM 0 Registrazione / Registrati

Seleziona la tua posizione

immagine dell'utente

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

Hardware design
novembre 19, 2020 by Jasmine 1462

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?

Tutti i commenti

user image

Laila postato su 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 postato su 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?

  • È necessario effettuare il login per rispondere. Registrazione | Registrati

user image

Laila postato su 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 postato su 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

Scrivi una risposta

È necessario effettuare il login per rispondere. Registrazione | Registrati