[comp.sys.ibm.pc.hardware] Accurate timing on AT-computer

gunnarkn@itk.unit.no (Gunnar Knutson) (05/23/91)

-- 
	I need to time the interval between two interrupts with
accuracy in the milli-seconds range. The maximum resolution on the AT
real time clock is one second, so I can't use that. Does anyone out
there have a better idea ?


Regards, Gunnar Knutson

Division of Engineering Cybernetics	: Phone +47 7 594376
The Norwegian Institute of Technology	: Fax   +47 7 594399
N-7034 Trondheim                        : Email gunnarkn@itk.unit.no
NORWAY

sladkey@cbnewsb.cb.att.com (john.r.sladkey..jr) (05/24/91)

In article <1991May23.152030.7710@ugle.unit.no> \
        gunnarkn@itk.unit.no (Gunnar Knutson) writes:

>       I need to time the interval between two interrupts with
> accuracy in the milli-seconds range. The maximum resolution on the AT
> real time clock is one second, so I can't use that. Does anyone out
> there have a better idea ?

> Regards, Gunnar Knutson

> Division of Engineering Cybernetics	: Phone +47 7 594376
> The Norwegian Institute of Technology	: Fax   +47 7 594399
> N-7034 Trondheim                        : Email gunnarkn@itk.unit.no
> NORWAY

There is an excellent book called "The Zen of Assembly Language"
(can't remember the author).  There are some canned routines that can be
typed in or used for learning about the hi resolution timer.  If you can
believe it, the timer is capable of nearly microsecond timing accuracy!
The book is great and the routines worked for me on my 386.

SIMTEL20 has two files that contain the listings from the book:

PD1:<MSDOS.ASMUTL>

ZENDISK1.ZIP ASMUTL    64821 0390 Listings from 'Zen of Assembly Language', #1
ZENDISK2.ZIP ASMUTL   108672 0390 Listings from 'Zen of Assembly Language', #2

ZENDISK1 contains the code of interest to hi-resolution timer.
Hope this helps, Rick Sladkey, mvjrs@mvgpk.att.com

tmkk@uiuc.edu (K. Khan) (05/24/91)

In article <1991May23.152030.7710@ugle.unit.no> gunnarkn@itk.unit.no (Gunnar Knutson) writes:
>
>-- 
>	I need to time the interval between two interrupts with
>accuracy in the milli-seconds range. The maximum resolution on the AT
>real time clock is one second, so I can't use that. Does anyone out
>there have a better idea ?

Here's one: get a better set of documentation on the AT's real time
clock - the docs which told you its maximum resolution was only 1 second
are quite thoroughly wrong.

Byte magazine published code for a timer routine which would accurately
measure events of less than 1 millisecond (e.g. something like 53 uS, if
I recall correctly). Whatever the exact number, such event timing CAN be done
with the AT's 8253 programmable timer chip. A good reference is Robert
Jourdain's "Programmer's Problem Solver" book (note: he now has a new one
out, co-authored by Peter Norton, which may replace the earlier book).

nelson@sun.soe.clarkson.edu (Russ Nelson) (05/24/91)

In article <1991May23.204102.17788@cbfsb.att.com> sladkey@cbnewsb.cb.att.com (john.r.sladkey..jr) writes:

   There is an excellent book called "The Zen of Assembly Language"
   (can't remember the author).

Michael Abrash.  1990, Scott Foresman and Company.  ISBN 0-673-38602-3.

Yes, it's excellent.  Anyone who cares about the speed of their code
should read it.

--
--russ <nelson@clutx.clarkson.edu> I'm proud to be a humble Quaker.
Clear cutting is criminal, spiking trees is criminal, and using hyperbole of
this magnitude in a serious discussion is criminal.  -- Irv Chidsey