UART: How to get "Transmission Complete" interrupt ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

UART: How to get "Transmission Complete" interrupt ?

1,682 次查看
alexeyborisenko
Contributor I

I whish to get interrupt after all bytes writen to TXDAT already fully sent, so I can disable my external RS485 transmitter from that interrupt. Is it possible?

     

Can I be sure that when TXRDY set (and I'm not write yet one byte after that), transmission of next byte (which is just now pushed into shift register) already started, so if I set TXDIS immediately now, that next byte will be transmitted before transmitter stopped and TXDISINT interrupt generated, and I can then use that interrupt to disable my extermal RS485 transmitter?

When exactly TXDISINT will be signalled? at end of stop bit? or in the middle?

I'm using LPC812.              

标记 (1)
0 项奖励
回复
1 回复

1,550 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Alexey Borisenko,

    1.Get interrupt after all bytes writen to TXDAT already fully sent

    From the UART hardware, LPC812 can't support it directly, TXRDYEN is jused to enables an interrupt when the TXDAT register is available to take another character to transmit.

   Actually, from the user manual, we just find these UART interrupt:

pastedImage_1.png

If you have more bytes to send, and you want to get the notification after all the data is sent, you can enable the TXRDYEN, in the ISR function, you can counter the send data number, when the number is meet your demand, you can set some flag which is defined by yourself, just use the software to realize it.

2. About the TXDIS and TXDISINT

   From the user manual descrption:

pastedImage_2.png

pastedImage_3.png

If the TX buffer already have the data, and you set the TXDIS, then the USART transmitter will be disabled after the TX buffer data is sent. The next data which is not moved to the TX buffer won't be sent. About the INT, I think it will be happen after the TX buffer data is complete, it is the end of the stop bit.

Wish it helps you!

If you still have question about it, please kindly let me know!

Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复