I am using an Arduino Mega. I was wondering if it is possible to use the RX on a serial port while not using the TX. In other words I'd like to use the TX pin for something else and I'm only using the serial port to receive and don't need to transmit. Is this possible?
"USART Initialization
The USART has to be initialized before any communication can take place. The initialization process normally consists
of setting the baud rate, setting frame format and enabling the Transmitter or the Receiver depending on the
usage. For interrupt driven USART operation, the Global Interrupt Flag should be cleared (and interrupts globally
disabled) when doing the initialization."
"Data Transmission – The USART Transmitter
The USART Transmitter is enabled by setting the Transmit Enable (TXEN) bit in the UCSRnB Register. When the
Transmitter is enabled, the normal port operation of the TxDn pin is overridden by the USART and given the function
as the Transmitter’s serial output. The baud rate, mode of operation and frame format must be set up once
before doing any transmissions. If synchronous operation is used, the clock on the XCKn pin will be overridden and
used as transmission clock."
"Data Reception – The USART Receiver
The USART Receiver is enabled by writing the Receive Enable (RXENn) bit in the
UCSRnB Register to one. When the Receiver is enabled, the normal pin operation of the RxDn pin is overridden by
the USART and given the function as the Receiver’s serial input. The baud rate, mode of operation and frame format
must be set up once before any serial reception can be done. If synchronous operation is used, the clock on
the XCKn pin will be used as transfer clock."
Just tweak up the Serial library to only enable the Receiver.
Way beyond me as to how you'd do that.
I'm using the three other serial ports to receive serial data on each of them. I'll have a look at the library and see if I can modify it for RX only as well as TX only. If I get the modification to work, maybe I'll submit for inclusion in standard libraries.