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

How can I use 2 Uart simultaneously?

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








How can I use 2 Uart simultaneously?
PostPosted: Tue Jan 15, 2008 3:11 pm     Reply with quote

Hello everybody,

I'll design a new project and I'm going to use 2 uart simultaneously.
I have a serious problem about the code to do this.
I use
Quote:
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, stream=PC)

to set up a software serial communication and
Quote:
#use rs232(baud=9600, xmit=PIN_C7, rcv=PIN_C6, stream=PC)

and Hardware serial Communication
Problem 1:
What need I do to set up the over serial Communication to work together in the same project?

Sorry about my English.
I_AM_CCS
Guest







PostPosted: Tue Jan 15, 2008 4:08 pm     Reply with quote

specify different stream names in the #use statements:
Code:

#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, stream=SOFT_UART)
#use rs232(baud=9600, xmit=PIN_C7, rcv=PIN_C6, stream=HARD_UART)


and then use fprintf() to specify which stream to print to:

Code:
fprintf(SOFT_UART, "This will be printed on the software UART");
fprintf(HARD_UART, "This will be printed on the hardware UART");
Guest








How can I do this with putc?
PostPosted: Tue Jan 15, 2008 4:23 pm     Reply with quote

How can I do this with putc?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

Re: How can I do this with putc?
PostPosted: Tue Jan 15, 2008 5:13 pm     Reply with quote

Anonymous wrote:
How can I do this with putc?
You can't. Use fputc() instead.
Code:
fputc( 'A', stream_name);
Guest








PostPosted: Tue Jan 15, 2008 5:36 pm     Reply with quote

Thanks for ALL...!!
regiscruz



Joined: 16 Jan 2008
Posts: 1
Location: Brazil

View user's profile Send private message Visit poster's website MSN Messenger

PostPosted: Wed Jan 16, 2008 1:45 pm     Reply with quote

Thank you very much everyone, I was looking for for this example also.
It's work very well...
The only observation, the correct thing is:

Code:

#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, stream=HARD_UART)


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