Use of timing loop???

From: Charles Sullivan (cwsulliv_at_triad.rr.com)
Date: 11/23/05


Date: Wed, 23 Nov 2005 15:11:58 GMT

I have a user app which talks to an external device by toggling
the status lines on an RS232 serial port. To make a particular
feature of this app work, I have to toggle the lines 80 times
within a period of about 150 milliseconds with a minimum delay
between toggles of 500 microseconds. (Longer is OK provided the
total elapsed time is less than 150 milliseconds.)

However a delay of 500 microseconds is much shorter than the timer
resolution, typically 10 milliseconds, available to user apps.
I can make this feature work by using a timing loop, i.e.,
  long loopcount = NNNN;
  while(--loopcount);

I recognize that the value of NNNN would have to be "calibrated"
individually for each system, that the system is tied up while
in the loop, and that the scheme could fail on a system heavily
loaded with higher priority tasks.

But aside from these minor details :-), what are the downsides
to using such a timing loop? (Or should I just forget the whole
idea?)

Regards,
Charles Sullivan



Relevant Pages

  • Re: Use of timing loop???
    ... >> I have a user app which talks to an external device by toggling ... >> within a period of about 150 milliseconds with a minimum delay ... >> I can make this feature work by using a timing loop, i.e., ... > scheduling - you'll need to do this in a driver. ...
    (comp.os.linux.development.apps)
  • Re: Use of timing loop???
    ... > I have a user app which talks to an external device by toggling ... > within a period of about 150 milliseconds with a minimum delay ... If you make your process a real time process, ... That depends on the kernel version. ...
    (comp.os.linux.development.apps)