View previous topic :: View next topic |
Author |
Message |
Guest
|
How can I use 2 Uart simultaneously? |
Posted: Tue Jan 15, 2008 3:11 pm |
|
|
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
|
|
Posted: Tue Jan 15, 2008 4:08 pm |
|
|
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? |
Posted: Tue Jan 15, 2008 4:23 pm |
|
|
How can I do this with putc? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
Re: How can I do this with putc? |
Posted: Tue Jan 15, 2008 5:13 pm |
|
|
Anonymous wrote: | How can I do this with putc? | You can't. Use fputc() instead. Code: | fputc( 'A', stream_name); |
|
|
|
Guest
|
|
Posted: Tue Jan 15, 2008 5:36 pm |
|
|
Thanks for ALL...!! |
|
|
regiscruz
Joined: 16 Jan 2008 Posts: 1 Location: Brazil
|
|
Posted: Wed Jan 16, 2008 1:45 pm |
|
|
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)
|
|
|
|
|