Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Re: Multitasking

2005-04-10 by David Kelly

On Apr 9, 2005, at 1:29 PM, arhodes19044 wrote:

> Really, my application is fairly linear.  About every second a
> display needs updating with a few calculations.  Data entry happens
> on another display/keypad.  Whenever certain external hardware
> triggers (about 1Hz to 130hz), a counter is incremented, or(less
> freqently) a few integer and float calculations are done based on
> that counter and some vars are updated for display.

I suggest that you capture data in an IRQ service routine but postpone 
any calculations until outside of user time. Especially don't try to 
update the display. The display won't update that quickly, also you 
will create a problem of knowing when your foreground process is 
allowed to write to the display so as not to be clobbered by writes 
from IRQ. Always do it in the foreground and not have any problems.

Sharing data between IRQ time and foreground time causes an issue. A 16 
bit value may change if an IRQ occurs half way thru reading its hi/lo 
bytes. Simplest solution is to disable IRQ, copy the values, enable 
IRQ.

--
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.