Will like some help on how to disable and enable the 4 UARTs on the MEGA.
For the Uno I see the following code for the single UART it has:
UCSR0B &= ~(_BV(TXEN0)); //disable UART TX UCSR0B &= ~(_BV(RXEN0)); //disable UART RX
I would like to know to do the same for the 4 UARTs on the Mega.
Thanks in advance.
Same way. There are UCSRnB registers and TXENn, RXENn bits; n={0,1,2,3} according the UART number. See the datasheet for details.
Note that none of the uarts are enabled unless you call Serial.begin() (or serial1, 2, or 3) - you only need to fiddle with the register directly if you want to disable rx but not tx, or the other way around.
Thanks very much guys!