Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Re: WinAvr or CodeVision, which one is more public?

2008-01-22 by David VanHorn

> U talked of RTOS. Never heared of it before, but my MCU needed to
> control RH, light level and temperature real time and show them on
> LCD, so I thought and then I made for myself a sort of virtual multi-
> tasking procedure, for example:
>
> Do
>  Gosub v
>  Gosub w
>  Gosub x
>  Gosub y
>  Gosub z
> Loop
> End
>

This is the guts of a cooperative multitasker.
The trick is to divide up the tasks so that none of them really do
very much, and they don't do anything if they don't have to.
Then take your time-critical I/O and handle that in ISRs, just
buffering the data into ram and letting the system deal with the
buffered data.

In one system I'm working on, there's an ISR to catch serial data from
a GPS, putting that in a serial input buffer.
One of the routines in the main loop scans that buffer for a valid
NMEA sentence.
Another routine takes a valid sentence from that buffer and puts it in
another buffer for parsing.
Another parses any sentences that arrive.
...
...
...
and so on.

Each does very little, and the idea is to return to main as fast as possible.

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.