Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Two or more serial ports

2005-08-01 by David Kelly

On Sun, Jul 31, 2005 at 10:04:25PM -0000, jdelgadillo66 wrote:
> Im working in a project with atemega8 and atemega32, for this work is 
> necessary 3 serial ports, and I cant loose any data, but what happen if 
> two or more ports have incoming data at the same time?, what can I do?, 

As others have said, assign the hardware UART to interrupt service
routines. Do nothing in IRQ other than copy data to/from circular
buffers. Then you will not loose data so long as the IRQ is not blocked
longer than one character time. You have at least the duration of the
current incoming character to get the previous character out of the
FIFO. Some hardware UARTs have deeper FIFOs.

Then you have to process the characters in the circular buffer outside
of IRQ fast enough to prevent your buffer from overflowing.

> other question is what is the adventage for use usart hardware or
> usart software?.

In software one must IRQ (or sample) at least once per bit, and the
exact timing of the IRQ service routines becomes critical. Software
UARTs require a fair amount of timer resources.

In general one does not use software UART unless painted into a corner
and the issue forced. Then again if one knows plenty of CPU and timer
resources are available then a soft UART may result in lower cost.

-- 
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.