CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

using uart1 without tx

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hansknec



Joined: 30 Sep 2004
Posts: 25
Location: Virginia, USA

View user's profile Send private message Visit poster's website

using uart1 without tx
PostPosted: Mon Jun 16, 2008 8:52 pm     Reply with quote

PIC18F1320.
PCWHD version 4.071.

I am using the hardware uart for serial receive, but I am not doing any transmitting. I use an interrupt (INT_RDA) to capture the incoming serial, so I have to stick with the hardware uart.

I am using the #use rs232(baud=9600,uart1) preprocessor command and my receives work perfectly, but it takes over the TX pin RB1 and holds it high. Is there anything I can do to release it? I have tried setting the TXSTA byte to zero, but then I lose receive as well for some unknown reason.

Running very low on pins, so I sure would like to get RB1 released for I/O.

Thanks.
Ttelmah
Guest







PostPosted: Tue Jun 17, 2008 2:13 am     Reply with quote

Define both pins as normal for the hardware UART, as you are doing.
Then add:
Code:

#byte TXSTA=0xFAC
#bit TXEN=TXSTA.5

#define UART_TX_OFF TXEN=FALSE
#define UART_TX_ON TXEN=TRUE

You can then have:

UART_TX_OFF;

in your code, and just the transmit part of the UART gets turned off.
Now, you _may_ have problems with TRIS. I always use 'fast_io', and this then works fine, if I set the corresponding TRIS bit and '0' for output, or '1' for input. However the compiler will still think the bit is used fo the UART, and if left to using 'standard_io', may well keep trying to set the TRIS bit to '1' (which is what is needed for UART operation).
Two ways round this, either switch to using fast_io, or access this pin, and it's TRIS directly, using bit definitions.
It takes a little bit of fiddling, but does work fine (has been posted here a few times in the past).

Best Wishes
hansknec



Joined: 30 Sep 2004
Posts: 25
Location: Virginia, USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Jun 17, 2008 6:56 am     Reply with quote

Thanks Ttelmah,

That's a relief since I already had 50 boards made using the TX pin to drive a fet.

I know it was probably posted before, but I seem to have difficulties getting the search engine to give me a meaningful list from my search requests. Too bad we can't put a google search engine in it. It would eliminate a lot of stupid duplicate requests (like the one I just asked).
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group