Searching \ for '[PIC]: Multiple serial (RS232) interfaces on a PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=rs232
Search entire site for: 'Multiple serial (RS232) interfaces on a PIC'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Multiple serial (RS232) interfaces on a PIC'
2008\06\12@094640 by tinu b

picon face
i need to handle multiple serial interfaces on a pic18fxxxx (28pin pic).

i need at least 2 bidirectional rs232 interfaces, running at 9600bps.

there is no 28 pin pic with 2 hardware usart interfaces, so i think i need a
software solution.

i tried to design a 2 channel full duplex software uart, running with 8x
oversampling, polling the rx lines, detecting startbit and sampling rx lines
in the middle of the bit of each rx line.
unfortunately, this seems to use the full power of the pic, not leaving any
performance left to do other things.
is there a good solution for a pic18 multi-uart around?

thanx!
tinu

2008\06\12@100027 by Dario Greggio

face picon face
tinu b wrote:

> there is no 28 pin pic with 2 hardware usart interfaces, so i think i need a
> software solution.

have you checked dsPICs and PIC24 as well?

> i tried to design a 2 channel full duplex software uart, running with 8x [...]
> unfortunately, this seems to use the full power of the pic, not leaving any
> performance left to do other things.
> is there a good solution for a pic18 multi-uart around?

Though I'd find it strange that, @9600 baud, you did employ the whole
power of PIC (what clock speed, by the way?) , I can tell that you could
use one (or 2) SPI-slave device which act as USART. Somebody
(JBroadwell?) at forum.microchip.com did do that.

--
Ciao, Dario

2008\06\12@102339 by M. Adam Davis

face picon face
On 6/12/08, tinu b <spam_OUTtinu.piclistTakeThisOuTspamgmail.com> wrote:
> there is no 28 pin pic with 2 hardware usart interfaces, so i think i need a
> software solution.

There are at least 23 PICs that are 28 pins with 2 UART or USART interfaces.

There are 20 sixteen bit PICs with two UART interfaces - all 24 and 30
series, the least expensive of which appears to be PIC24FJ16GA002,
under $2 in volume.
www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en520629
Even comes with a FIFO on the uarts.

There are 3 18F parts with 2 USART interfaces, though they are future
products: PIC18F24J11, PIC18F25J11, PIC18F26J11

-Adam

--
EARTH DAY 2008
Tuesday April 22
Save Money * Save Oil * Save Lives * Save the Planet
http://www.driveslowly.org

2008\06\12@102807 by tinu b

picon face
i'd like to use a single pic18 with just an rs232 level converter, but no
additional hardware, to make hardware as simple as possible.
the pic18 is running at 40mhz, i.e. 10mhz instruction cycle. with interrupt
driven 8x oversampling of the 9600bps, i get an interrupt every 130
instructions.
as this interrupt has to handle 2 or more bidirectional uart functions,
there is not much left...


2008/6/12 Dario Greggio <.....adpm.toKILLspamspam@spam@inwind.it>:

{Quote hidden}

> -

2008\06\12@104500 by olin piclist

face picon face
tinu b wrote:
> there is no 28 pin pic with 2 hardware usart interfaces,

30F3013.

********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\06\12@105401 by Jeff Zentner

flavicon
face
I would recommend finding a solution with hardware for all uarts. I am
maintaining a product with a bit banged uart and it is nothing but trouble.

Jeff Z

{Original Message removed}

2008\06\12@105429 by tinu b

picon face
as my design environment only supports 16f and 18f, i am limited to these
series.
pic16 do only have 1 usart.
pic18 with 2 usart are not yet available.
so i need to do a software solution.

2008/6/12 M. Adam Davis <stienmanspamKILLspamgmail.com>:

{Quote hidden}

> -

2008\06\12@110124 by Dario Greggio

face picon face
tinu b wrote:

> the pic18 is running at 40mhz, i.e. 10mhz instruction cycle. with interrupt
> driven 8x oversampling of the 9600bps, i get an interrupt every 130
> instructions.

what if tou oversampled less? Do you have some robust error-checking in
place, or can you live with some errors?

--
Ciao, Dario

2008\06\12@110835 by olin piclist

face picon face
tinu b wrote:
> as my design environment only supports 16f and 18f
> ...
> so i need to do a software solution.

Or fix your design environment.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\06\12@111132 by M. Adam Davis

face picon face
Can you tell us the nature of the two serial devices and data?  We may
be able to come up with a more elegant solution than "more hardware."

In a project I'm working on now I have 3 UARTs, but need 5.  Four of
them, however, are for cameras taking intermittent pictures so I'm
using a multiplexor so I can select which camera I want one of hte
UARTs connected to, and use another UART for a dedicated device.

Can you slow down the communications of one of the devices?

You might be able to get away with lower processor usage if you
develop a much more complex bit banging routine, and use interrupts on
the RX line.  When the line changes, start a timer so you can sample 3
times in the middle of the bit, and have that timer trigger an
interrupt.  Sample each bit only 3 times near the middle until the
stop bit, and for each byte you've only spent 31 interrupts.  The TX
routine is even simpler - 11 interrupts per byte.

Run the processor faster.

Beyond those suggestions, the answer is usually "more hardware," such
as another PIC, an SPI uart, a 16 bit device, a different MCU
altogether (AVR, MSP430), etc.

What is the application and types of data going across?

-Adam

On 6/12/08, tinu b <EraseMEtinu.piclistspam_OUTspamTakeThisOuTgmail.com> wrote:
> as my design environment only supports 16f and 18f, i am limited to these
> series.
> pic16 do only have 1 usart.
> pic18 with 2 usart are not yet available.
> so i need to do a software solution.

--
EARTH DAY 2008
Tuesday April 22
Save Money * Save Oil * Save Lives * Save the Planet
http://www.driveslowly.org

2008\06\12@111506 by tinu b

picon face
i think i have to reduce to 4x oversampling. hope that will run stable
enough.
unfortunately, i have no error checking, as on one port, i have a terminal
which is used to configure the device, and on the other port, there comes
logged data which has to be compared to the configured pattern to generate
output sequences.
as the data logging device is 3rd party, i have no influence on it's coding,
i.e. i cannot add any redundancy or reduce the bitrate.


2008/6/12 Dario Greggio <adpm.tospamspam_OUTinwind.it>:

{Quote hidden}

> -

2008\06\12@112150 by Dario Greggio

face picon face
M. Adam Davis wrote:

> There are at least 23 PICs that are 28 pins with 2 UART or USART interfaces.

thank you Adam :)

--
Ciao, Dario

2008\06\12@112227 by Dario Greggio

face picon face
M. Adam Davis wrote:

> Run the processor faster.

Those "K" PICs @64MHz might help...

--
Ciao, Dario

2008\06\12@112333 by Alan B. Pearce

face picon face
>as my design environment only supports 16f and 18f, i am limited to these
>series.
>pic16 do only have 1 usart.
>pic18 with 2 usart are not yet available.
>so i need to do a software solution.

The C18 compiler used to have a software UART as a library module. I believe
it may be dropped from later releases though.

2008\06\12@114622 by Dario Greggio

face picon face
Alan B. Pearce wrote:

> The C18 compiler used to have a software UART as a library module. I believe
> it may be dropped from later releases though.

no, it's still here.
But it does not use interrupts, making actually it a bit useless, as for
receiver at least.

--
Ciao, Dario

2008\06\12@115551 by Bob Blick

face
flavicon
face

On Thu, 12 Jun 2008 15:46:22 +0200, "tinu b" <@spam@tinu.piclistKILLspamspamgmail.com>
said:
> i need to handle multiple serial interfaces on a pic18fxxxx (28pin pic).
>
> i need at least 2 bidirectional rs232 interfaces, running at 9600bps.
>
> there is no 28 pin pic with 2 hardware usart interfaces, so i think i
> need a
> software solution.
>
> i tried to design a 2 channel full duplex software uart, running with 8x
> oversampling, polling the rx lines, detecting startbit and sampling rx
> lines
> in the middle of the bit of each rx line.
> unfortunately, this seems to use the full power of the pic, not leaving
> any
> performance left to do other things.
> is there a good solution for a pic18 multi-uart around?

Hi Tinu,

I have done one 9600 bps uart using timer0 interrupt in software with a
circular buffer at 14MHz on a 16F84A. In "C". So you should be able to
do it on an 18F with two software uarts. You can sample at 2x the baud
rate. Setting your timer interrupt to some exact multiple of the baud
rate is important. So in this case interrupt 19200 times per second. If
you have a 40MHz clock you should have plenty of cycles left over even
with two software channels.

Cheerful regards,

Bob

--
http://www.fastmail.fm - Access all of your messages and folders
                         wherever you are

2008\06\12@124825 by Andre Abelian

flavicon
face
Hi Bob,

At work they use serial LCD's I personally do not like them at all but
It wasn't my choice. 6 serial LCD's I used pic18F4550 with CCS c
compiler
Software UART it did it by just adding 1 line of code per uart. CCS has
built in function. In fact with software uart I could invert the data
but using hardware uart can't be done only externally can be inverted.

Andre


{Original Message removed}

2008\06\12@142753 by peter green

flavicon
face

> unfortunately, i have no error checking, as on one port, i have a terminal
> which is used to configure the device,
What is this terminal? If it is a PC have you considered using USB?
(though that can also eat quite a bit of CPU time)

2008\06\12@151302 by Enki

picon face
On 12 Jun 2008 at 10:27, Bob Blick wrote:

{Quote hidden}

       I have done soft-uarts using just 1x sampling.
       Detected the start-bit with an edge interrupt, set the next timer
interrupt for 1.5 bit-time and the other interrupts for one bit-time.

       Never had a single problem but never used on noisy signals.

       Mark Jordan


2008\06\12@152637 by Dario Greggio

face picon face
Enki wrote:

>        I have done soft-uarts using just 1x sampling.
>        Detected the start-bit with an edge interrupt, set the next timer
> interrupt for 1.5 bit-time and the other interrupts for one bit-time.
>
>        Never had a single problem but never used on noisy signals.

yep, same here.
I understand oversampling is better, but I believe a trade-off is reachable.

--
Ciao, Dario

2008\06\12@153734 by Mark Rages

face picon face
>        I have done soft-uarts using just 1x sampling.
>        Detected the start-bit with an edge interrupt, set the next timer
> interrupt for 1.5 bit-time and the other interrupts for one bit-time.
>
>        Never had a single problem but never used on noisy signals.
>
>        Mark Jordan
>
>

I've done this with a PICkit 2. (18f2550 @ 48 MHz Fosc.)  I needed two
read-only channels with timing information to act as a protocol
analyzer between two devices.  it worked fine but needed a nice clean
signal (no oversamping).  I was able to capture at baudrates up to
115200, but only for short messages.  (I had a 256-byte circular
buffer and was using HID code).  Someday I'll clean up the code and
get it on my weblog.

Regards,
Mark
markrages@gmail
--
Mark Rages, Engineer
Midwest Telecine LLC
RemoveMEmarkragesTakeThisOuTspammidwesttelecine.com

More... (looser matching)
- Last day of these posts
- In 2008 , 2009 only
- Today
- New search...