News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

UART Stop

Started by Teo, Apr 27, 2026, 09:58 PM

Previous topic - Next topic

Teo

Hello everyone,
I need to send a BMP via UART to a printer.
How can I stop sending when an interrupt occurs and resume it after handling the interrupt?
Does anyone have any idea? 
Thanks in advance,
Teo

Oskar-svr

Hi friend, you need to find the manual for the printer you're using. To do this, you should ask the manufacturer or look for the ESCPOS command manual. This contains the commands to program communication and initialize the printer, such as paper size, UART communication configuration, and other things you need to do to get the printer working.

And what printer are you planning to use?

Teo

Hello,
I will use the RTS signal given by the printer.
The problem is how I can stop the data stream transmission when the microcontroller detects an IOC (RTS) interrupt.
How can I stop the UART from transmitting and resume the transmission after the printer gives OK?
Thank you in advance,
Teo

trastikata

Use the hardware UART module where the buffer there is 1 byte, transmission is interrupt driven i.e. you load new byte in the buffer as soon as the old one is shifted out.

So use priorities when you detect IOC, go there, set a bit marker that will hold the UART hardware, execute the high priority IOC and return to the UART interrupt to load new byte in the buffer.

But you can not cut a transmission in half a byte (unless you disable the module). For something like this you will have to write own software based UART to hold and resume mid byte transmission.