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

Using 2 uarts at once

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



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

Using 2 uarts at once
PostPosted: Tue Dec 18, 2007 3:24 pm     Reply with quote

I want to build a device that talks to 2 devices serially. They will be at different baud rates, and the only thing the pic needs to do is translate. Basically ready a few bytes at 19200, send them out the other port at 1Mb, then get a 1Mb response, and send it back at 19200.
My question is should I go with 1 uart, and a software uart, or find a pic like a 18f4680 that has 2 uarts? If I go with the 1 Uart I have to poll to get info from the SW uart, if I go with a 18f4680 , can I set up 2 different #int_RDA routines? How does that work?
Thanks
Ringo
_________________
Ringo Davis
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Tue Dec 18, 2007 3:53 pm     Reply with quote

To answer the 2nd part,

#INT_RDA

and then
#INT_RDA2

For the 1st part, 1M is pretty darn fast - not sure you can. Others?

Ken
ckielstra



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

View user's profile Send private message

PostPosted: Tue Dec 18, 2007 4:33 pm     Reply with quote

Are the communications full-duplex or half-duplex? i.e. is the sequence exactly as you described where there is only one action at a time (half-duplex), or is it possible you are listening at one port while transmitting at another port (full-duplex)?

In the half-duplex situation you could assign the soft UART to the 19k2 connection and use the hardware UART for the 1Mb connection. For a full-duplex it will be very difficult to implement with a software UART.

Either case: If you have the option open to choose a new chip with two hardware UARTs I would go for that as it makes writing the software a lot easier. A software UART does not generate interrupts and makes the software a lot more difficult. Price is not a criterium as a chip like the PIC18F65J10 with two UARTs is available for $2.15.

Note: the PIC18F4680 has only 1 hardware UART.
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