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

Discussion in 'Embedded Systems and Microcontrollers' started by spinnaker, Nov 18, 2012.

  1. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    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
  2. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    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.
  3. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    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.