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 support@ccsinfo.com

Passing rs232 stream id into a function PCD

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



Joined: 15 Dec 2009
Posts: 3

View user's profile Send private message

Passing rs232 stream id into a function PCD
PostPosted: Tue Dec 15, 2009 7:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Dec 15, 2009 10:41 pm     Reply with quote

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=21441
Guest








PostPosted: Thu Jan 07, 2010 2:46 pm     Reply with quote

Thanks for the link, although I don't like hearing that it's impossible. Sad

It did give me an idea though!
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Jan 09, 2010 11:47 am     Reply with quote

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
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