View previous topic :: View next topic |
Author |
Message |
SpaceXDebris
Joined: 15 Dec 2009 Posts: 3
|
Passing rs232 stream id into a function PCD |
Posted: Tue Dec 15, 2009 7:38 pm |
|
|
Hey,
Sorry if this is a dumb question. I'm using PCD compiler with a dsPIC30F4011.
As in the manual, I'm using two rs232 ports by doing:
Code: |
#use rs232(baud=57600, xmit=PIN_F5, rcv=PIN_F4, stream=COM_A)
#use rs232(baud=57600, xmit=PIN_F3, rcv=PIN_F2, stream=COM_B)
|
I would like to define a function like so:
Code: |
int sendSerialPacket(int* data, int length, short com)
{
// Code
}
|
which would be called like:
Code: |
sendSerialPacket(data, 4, COM_A)
|
or something like that.
How do I type this stream_id variable? I know that it's an 8-bit constant, so I've tried short and char and adding const. I'm trying to use the pre-processor as little as possible.
Thanks for the help. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Guest
|
|
Posted: Thu Jan 07, 2010 2:46 pm |
|
|
Thanks for the link, although I don't like hearing that it's impossible.
It did give me an idea though! |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sat Jan 09, 2010 11:47 am |
|
|
It's not impossible.
You just have to use a switch statement.
So you *can* accomplish sending to one COM or another, you just can't do it by manipulating the STREAM ID.
Cheers,
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|