21.01.2015 Views

INtime® 3.1 Software - tenAsys

INtime® 3.1 Software - tenAsys

INtime® 3.1 Software - tenAsys

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5: Designing RT applications<br />

Interrupt and event processing<br />

Multi-tasking<br />

Interrupts and internal events occur at the bedside units: bedside personnel enter<br />

commands asynchronously and the system computes toxicity levels at regular<br />

intervals.<br />

Toxicity levels, measured as the blood enters the bedside unit, are not subject to abrupt<br />

change. The machine slowly removes toxins while the patient's body, more slowly,<br />

puts toxins back in. The result is a steadily declining toxicity level. The bedside units<br />

must monitor toxicity levels regularly, but not too frequently. For instance, the bedside<br />

units could compute the toxicity levels once every 10 seconds, using a clock for timing.<br />

The measurement thread would measure and compute the toxicity, put the information<br />

in a mailbox for the MCU, and suspend itself for 10 seconds.<br />

Command interrupts from the bedside unit occur when a medical operator types a<br />

command and presses Enter. Interrupts from command entries occur at random times.<br />

The interrupt handler signals the interrupt thread. The interrupt thread performs any<br />

required processing and waits for the next interrupt.<br />

Processing commands from the bedside units: Each time a medical operator types a<br />

command and presses Enter, the bedside unit receives an interrupt signal from the<br />

terminal. The bedside unit stops executing the current instruction and begins to<br />

execute an interrupt handler.<br />

1. The interrupt handler accumulates the characters in a buffer and puts them in<br />

memory. The interrupt handler signals the interrupt thread for bedside commands.<br />

2. The interrupt thread gets the contents of the memory where the handler put the<br />

command. It parses the command and does the required processing.<br />

3. The thread puts the command information, along with the number of the bedside<br />

unit, into a message.<br />

4. The thread sends the message to the predetermined mailbox for the MCU.<br />

5. The interrupt thread waits for the next interrupt. The system returns to its normal<br />

priority-based, preemptive scheduling.<br />

Threads in the application run using preemptive, priority-based scheduling. This<br />

allows the more important threads, such as those that control the dialysis rate, to<br />

preempt lower-priority threads, such as those that update displays. New capabilities<br />

can be added to the system by simply adding new threads.<br />

59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!