View previous topic :: View next topic |
Author |
Message |
maxrate
Joined: 01 Jan 2007 Posts: 38 Location: Mississauga, Ontario, Canada
|
Two serial ports - define in C |
Posted: Mon Oct 13, 2008 4:40 pm |
|
|
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
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
maxrate
Joined: 01 Jan 2007 Posts: 38 Location: Mississauga, Ontario, Canada
|
|
Posted: Mon Oct 13, 2008 5:22 pm |
|
|
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
|
|
Posted: Mon Oct 13, 2008 5:37 pm |
|
|
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
|
|
Posted: Mon Oct 13, 2008 6:06 pm |
|
|
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
|
|
|
|