comp.lang.ada
 help / color / mirror / Atom feed
From: jm59@prism.gatech.edu (John M. Mills)
Subject: Short DOSish note (was Re: Timing Ada programs using the DEC UNIX microtimer kernel option)
Date: 1998/05/01
Date: 1998-05-01T00:00:00+00:00	[thread overview]
Message-ID: <6id2df$i2j@acmey.gatech.edu> (raw)
In-Reply-To: 6i27ap$m85$1@panoramix.fi.upm.es


Sorry - no Ada content, but perhaps a useful pointer for fixed-sample-interval
DOS (or Win3.1, presumably) code, such as instruments or controllers:

jzamora@avellano.datsi.fi.upm.es (Juan Zamorano Flores) writes:
>     I don't know DEC UNIX but in DOS the hardware timer interrupts at
>18.2 Hz.  But you can have microseconds resolution if you read the hardware
>timer downcount register.

DOS needs the 18.2Hz to continue for important services, but you can easily
'hook' the interrupt, reprogram the counter, and call a user routine at
multiples of 18.2 Hz, so long as you also call the DOS service at 18.2 Hz.
I've used 90 Hz for control-loop closure.  (As always, remember that DOS itself
is _not_ re-entrant: make a local stack and be prepared for surprises if your
ISR tries to use DOS services!)

Two 'C' examples for DOS can be found on:
   ftp://jmills.gtri.gatech.edu/pub
as:
   tichandl.gz  ('C' source file example which reprograms the timer, runs a
                 while, restores the timer, then exits), and
   ballgame.tgz (whistles "Take me out to the Ballgame" on your PC speaker -
                 will drive your colleagues #@$!! nuts.)

Both are gzipped; 'tichandl.gz should be unpacked into 'tichandl.c'.

I received a copy of the 'ballgame' example, then did the simpler 'tichandler'
as my own intro exercise.  Translation into Ada and other PC OS's remains an
exercise to the reader.

-- 
 John M. Mills, Senior Research Engineer   --   john.mills@gtri.gatech.edu
   Georgia Tech Research Institute, Georgia Tech, Atlanta, GA 30332-0834
        Phone contacts: 404.894.0151 (voice), 404.894.6258 (FAX)
           "Lies, Damned Lies, Statistics, and Simulations."




  reply	other threads:[~1998-05-01  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-25  0:00 Timing Ada programs using the DEC UNIX microtimer kernel option David Coote
1998-04-25  0:00 ` Joe Gwinn
1998-04-26  0:00   ` Jonathan Stone
1998-04-26  0:00     ` David Coote
1998-04-28  0:00     ` Jeffrey Mogul
1998-04-27  0:00 ` Juan Zamorano Flores
1998-05-01  0:00   ` John M. Mills [this message]
1998-05-01  0:00     ` Short DOSish note (was Re: Timing Ada programs using the DEC UNIX microtimer kernel option) Jerry van Dijk
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox