[comp.lang.pascal] Accurate Delays with Turbo Pascal or C

murphy@newton.physics.purdue.edu (William J. Murphy) (07/11/90)

Recently, someone posted a unit for using one of the timers in the PC
architecture.  I compiled it and tried to modify it to create a custom
delay function similar to the one(s) supplied by Borland.  The timer
unit was able to give 10 microsecond interrupts instead of the usual 18.2Hz.
Any ways, I had little luck in getting a consistant delay.  It seems that
there is a rollover that takes place with the timervalue which I don't
yet understand.  Thus I would be ok for a few cycles then get stomped by
a short cycle.  

What I need is a very accurate delay that won't interrupt a DMA transfer
that will always be occuring simultaneously.  I am using the delay function
to turn on and off a DIO line which connects to a switch which controls
my stimulus.  The DMA transfer is the A/D conversion of the stimulus plus
a signal which is dynamically affected by the stimulus.

Does the author of the Timer unit have any suggestions about writing such
a delay function?  Borland's delay function is accurate to within +- 0.7
milliseconds, as well it has a periodic behaviour in its measured delay.
I would be happy if I could get +-0.05 milliseconds standard deviation.

Thanks,
-- 
Bill Murphy                                  | Is this a holdup? ...
murphy@newton.physics.purdue.edu             | No, it's a science experiment.
Amiga, it's not a religion, it's a lifestyle |     Emmett L. Brown  BTF III