From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,b3c24209310418d0 X-Google-Attributes: gidfee84,public X-Google-Thread: 103376,b3c24209310418d0 X-Google-Attributes: gid103376,public X-Google-Thread: 1164f8,b3c24209310418d0 X-Google-Attributes: gid1164f8,public 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 Message-ID: <6id2df$i2j@acmey.gatech.edu>#1/1 X-Deja-AN: 349379474 References: <6hsab5$rh1$1@eplet.mira.net.au> <6i27ap$m85$1@panoramix.fi.upm.es> Organization: Georgia Institute of Technology Newsgroups: comp.unix.osf.osf1,comp.sys.dec,comp.lang.ada Date: 1998-05-01T00:00:00+00:00 List-Id: 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."