Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Re: Teenagers should write code.

2004-09-07 by Dave VanHorn

>
>No, this is not true. My cooperative multi-tasking operating system, 
>ECROS (see http://ecros.ecrostech.com), includes an event mechanism. 
>There is no polling. When an event is sent to a task, the task is 
>queued for execution if that event causes its ready condition to be 
>satisfied. I suppose you could say that the queues are polled, but I 
>think this would be stretching the definition of polling a bit far.

Ok, so there is then a list of tasks that are ready to be executed, which you drop through. Eventually, you hit the end, and start over, or just sit in a loop waiting for more tasks to do?

How exactly do you "send" an event to a task?

In terms I'm familiar with (I'm an assembler kind of guy), I might be sending data to a UART.  

First, I'd check wether handshake allows anything to be sent.
sbis PORTA,HSIN
ret


Second, I'd check wether the UART is actively sending something.
SBIC Ser_Flags,SER_TX_Busy
ret


Third, I'd check wether there's anything in the serial out buffer, to send.
Point at buffer, call circ_get, returns carry set if nothing in the buffer, 
otherwise returns carry clear, and the next byte to send.
brcs to label with return

If all these tests pass, then I put the byte to send in a single SRAM location, set the baud rate timer (software UART) to a minimum interval to trigger a timer int, and exit.

The int then causes the start bit, data bits, and stop bit to be sent, then the uart is marked as "not busy".

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.