Yahoo Groups archive

AVR-Chat

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

Thread

polling or interrupt driven transmission and receiving.

polling or interrupt driven transmission and receiving.

2007-11-08 by bigningbo

Hi,

I try to write a routine for RS232 communication between PC and AVR.
Which  way is best if I transmit a string to PC by using a interrupt
driven transmission or not by using interrupt? How will performance
affects if a string is long by interrupt driven transmission? Will
interrupt occur character by character? Thanks in advance!

Best Regards
Alex

Re: [AVR-Chat] polling or interrupt driven transmission and receiving.

2007-11-11 by David Kelly

On Thu, Nov 08, 2007 at 08:52:30PM -0000, bigningbo wrote:
>
> I try to write a routine for RS232 communication between PC and AVR.
> Which  way is best if I transmit a string to PC by using a interrupt
> driven transmission or not by using interrupt?

Neither is best, it all depends on what you want to do.

> How will performance affects if a string is long by interrupt driven
> transmission?

What is there to affect/effect? Either way you will probably send each
character tail-up (circus animals in a parade closely packed with tails
up in the air).

> Will interrupt occur character by character? Thanks in advance!

It could interrupt every other character. You can interrupt each time
the TX shift register is empty, and/or you can interrupt when the double
buffer is empty.

With interrupt driven transmitter you have to provide a buffer big
enough to hold whatever you might send in one block. Or you have to test
for buffer full and block your program from sending more data until the
serial port catches up. If your application has nothing else to do until
the data string is sent then polling is much simpler and every bit as
good.

A good compromise I often use is to poll on TX, interrupt on receive.

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

Re: [AVR-Chat] polling or interrupt driven transmission and receiving.

2007-11-11 by Reza

--- David VanHorn <microbrix@gmail.com> wrote:

> >
> > A good compromise I often use is to poll on TX,
> interrupt on receive.
> 
> VBG
> 
> I poll the tx buffer, and when it has something to
> send, I turn on the
> TX interrupt.
> :)
> 
> RX on int always though.
> 

for send or transmit simple data like strings it is
not important to use ISR or polling. but for complex
packet frames like in 3964 protocol or other serial
communication protocols, a state machine using both RX
and TX interrupts is perfect.



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

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.