To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 19184
19183  |  19185
Subject: 
Re: events or infinite loops... which is better?
Newsgroups: 
lugnet.robotics
Date: 
Mon, 14 Oct 2002 11:32:26 GMT
Original-From: 
PeterBalch <PeterBalch@[spamcake]compuserve.com>
Viewed: 
902 times
  
Rob

Something else you should consider is reliability.

There used to be a saying: "There are no interrupts on the Space Shuttle".
Maybe it's still true.

(By "Events", I assume you mean interrupts. Really, using Events is just a
design philoshopy and can be implemented using either interrupts or
infinite-loop polling.)

It is very, VERY difficult to write a reliable program that uses
interrupts. I write a lot of code for PIC chips (broadly similar to the
chip used in the RCX) any always avoid interrupts if I possibly can.

Typically, the chips have to keep an eye on half a dozen tasks at once - a
couple of serial I/O ports, a coin mechanism, a swipe-card reader a cancel
button, a relay or two, a text display, etc. etc. And I always do it all
with single master loop that polls each peipheral. It's a real pain keep
track of what each task is doing and never allow any task to hog more than
a millisecond of processing time but the programs must be 100% reliable and
have a MTBF of months or years.

Very occasionally I need to respond in microseconds and am forced to use an
interrupt. But usually a millisecond response time is perfectly acceptable.

Programing with interrupts is guaranteed to expose you to the full force of
Finagle's Law: "Anything that can go wrong, will".

Peter



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR