View previous topic :: View next topic |
Author |
Message |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
RS232 question |
Posted: Wed Jul 19, 2006 4:44 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Wed Jul 19, 2006 4:55 pm |
|
|
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)) |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jul 19, 2006 5:12 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Thu Jul 20, 2006 2:49 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
FYI |
Posted: Thu Jul 20, 2006 6:39 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Jul 20, 2006 8:56 am |
|
|
Thanks for the input!
Ronald |
|
![](templates/subSilver/images/spacer.gif) |
|