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

Two serial ports - define in C

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



Joined: 01 Jan 2007
Posts: 38
Location: Mississauga, Ontario, Canada

View user's profile Send private message

Two serial ports - define in C
PostPosted: Mon Oct 13, 2008 4:40 pm     Reply with quote

Hello, I'm using a 16F877A and I need two serial ports. I'm using the hardware UART to connect with a GSM modem (at 9600 baud), and I would like to establish a software UART (USART) on a different set of pins to receive NEMA GPS data (at 4800 baud). How in C do I define a second RS232 instance and how would I use the printf command? I've been looking thru the forum for about an hour to shed some light on this, but I can't seem to find what I'm looking for (apologies if something like this has already been posted)

Happy Thanksgiving & Columbus Day!
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 5:02 pm     Reply with quote

Try this:
http://www.ccsinfo.com/forum/viewtopic.php?t=33824
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 5:05 pm     Reply with quote

Quote:
How in C do I define a second RS232 instance ?

Also see the sample code in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=1555
maxrate



Joined: 01 Jan 2007
Posts: 38
Location: Mississauga, Ontario, Canada

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 5:22 pm     Reply with quote

Thanks for the feedback, that looks like it will do the trick! Subsequent question would be, why doesn't the CCS C compiler reference manual show the 'stream' directive in the book in the #use rs232 section? I feel like I'm missing something..
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 5:37 pm     Reply with quote

The current manual page 133

Printf/fprintf and the stream parameter is shown on page 203
maxrate



Joined: 01 Jan 2007
Posts: 38
Location: Mississauga, Ontario, Canada

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 6:06 pm     Reply with quote

I have two reference manuals, one from Sep 2006 and one from Aug 2007. I'll be upgrading later this year. I found a section called 'How can I use two or more rs-232 ports on one PIC?" - it answers my streaming questions as well. Thanks for all the help everyone!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 6:38 pm     Reply with quote

Also see the FAQ page. It has that question on it, and a lot more:
http://www.ccsinfo.com/faq.php
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