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

RS232 question

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



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

RS232 question
PostPosted: Wed Jul 19, 2006 4:44 pm     Reply with quote

Is it possible to define multiple TXD pins without defining corresponding RXD pins?

For example:
Code:
#use rs232(baud=9600,parity=N,xmit=PIN_C6,bits=8,STREAM=drive)
#use rs232(baud=9600,parity=N,xmit=PIN_C1,bits=8,STREAM=SIGN)
#use rs232(baud=9600,parity=N,xmit=PIN_C2,bits=8,STREAM=TEST)


This compiles just fine but is the compiler intelligent enough to not set up a RXD pin for each port? I need three TXD pins (I'm only sending data one way) but no RXD pins and I don't want to waste three pins that aren't going to be used.

Ronald
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

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

PostPosted: Wed Jul 19, 2006 4:55 pm     Reply with quote

YES
If you spec only 1 you get only one.

But if that is on a hardware port((and you don't force software)) then you get
both the TX and RX pins used. ((this last bit should be verified))
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 19, 2006 5:12 pm     Reply with quote

Quote:
use rs232(baud=9600,parity=N,xmit=PIN_C6,bits=8,STREAM=drive)

This will generate a soft UART transmitter on pin C6. If you want
a hardware UART Tx on that pin, then you must also specify pin C7
as the rcv pin in the statement above.
Ttelmah
Guest







PostPosted: Thu Jul 20, 2006 2:49 am     Reply with quote

However, note that if you specify both pins, to enable the hardware UART, and then just don't use the other pin, the code does not get generated. You can specify both pins in the #use RS232 line, and then simply not use any getc functions, and even use the pin for other things, and it'll work fine.

Best Wishes
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

FYI
PostPosted: Thu Jul 20, 2006 6:39 am     Reply with quote

Also with a software UART you can specify the same pin for TX and RX. A putc() makes it an output until a getc() makes it an input...
_________________
The search for better is endless. Instead simply find very good and get the job done.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Jul 20, 2006 8:56 am     Reply with quote

Thanks for the input!

Ronald
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