Pic USART - Why do I need to enable receive??

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Why do I need to enable receive?? I'm working with the pic usart on a Pic18f. I see from the data sheet that receive needs to be enabled to get the uart to work.

I thought I read that wrong or just didn't understand. Well I just tried it. If I disable RX than TX is disabled too!

That makes no sense to me at all. Why do I need RX? What if I have an application that just transmits? Why should I have to tie up a pin just to get it to work
 

nsaspook

Joined Aug 27, 2009
16,473
It's just how the pin mux was designed. I think the RX/TX pins can still be using for digital input just not digital output when SPEN = 1.
 

THE_RB

Joined Feb 11, 2008
5,438
Yep it's a nasty kludge by Microchip and has annoyed me a lot over the years especially when working with a PIC that has limited pins!

NSAspook is right the RX input pin will still work as a general digital input, as when reading a port the PIC always reads the voltage on the pin itself.

So you can enable the USART and just read the RX pin as a normal digital input, or another option is to code up a manual USART function (which is quite easy) and manually send serial data out a pin, any pin you like. Manual USART might tie up the PIC while it is actually transmitting, but that might still be ok.
 
Top