I want to make, preferably, or buy an RS485 converter that works when directly connected to the 5v Rx/Tx lines provided by the on-board UART.
However it looks as though I will need an RTS line, well a line that is high whenever the UART is transmitting anyway.
I had a look in the HardwareSerial Lib and it doesn't appear all that complex but none the less it is beyond my limited understanding of C++ right now.
I think all I need to do is have an additional pin go high if the Tx buffer has anything in it, but I could be wrong, I doubt I have appreciated any of the subtitles of the cod e.
If I was to set the new line HIGH on any call to the Write function and then set it low again when the buffer is determined to be empty and the interrupts are disabled, in
ISR(USART1_UDRE_vect) would that be correct?
Or am I looking at the wrong buffer as in a soft buffer as opposed to the actual buffer implemented by the UART
If that is the case then how would I go about using the Transmit Compete interupt that is mentioned in the datasheet
From the Data-sheet
When the Transmit Compete Interrupt Enable (TXCIEn) bit in UCSRnB is set, the USART
Transmit Complete Interrupt will be executed when the TXCn Flag becomes set (provided that
global interrupts are enabled). When the transmit complete interrupt is used, the interrupt han-
dling routine does not have to clear the TXCn Flag, this is done automatically when the interrupt
is executed.