delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/30/01:46:10

From: Phil Ehrens <imbe AT primenet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: High speed timing
Date: 29 Jan 1998 19:47:00 -0700
Organization: imbe.foo.bar
Lines: 27
Message-ID: <34D141EB.4BEBB1C8@primenet.com>
References: <34D11CA2 DOT 79CD AT bellsouth DOT net>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Lester Davis wrote:
> 
> What is the best way to get a time value between events. I'm getting
> ready to interface a sonar system to a pc and need to measure time of
> flight of the sonar. I don't want to use a simple counter. I'm sure
> there is a function that does what I need, any ideas?

The Linux port programming howto suggests 2 different ways to get a VERY
fast loop:

1. use a read from port 0x80, which is unused.  I use this with my high
speed data-acquisiton programs (which use Allegro for the video, it's
VEEERY fast!!) and get about two inp(0x080)'s per microsecond.

2. use an inline assembly line that just executes a NOP.  this should
take one processor clock cycle, I haven't tried this cuz the port 0x80
loop works fine for me (looping a data-acquisiton and pixel draw at 100
kHz).

so see the "ports" howto! (I know I am being a little disingenuous, but
all my notes on this are at work, and a quick web search just now makes
me think this document was just a part of my overactive imagination!)

if you need more help, e-mail me and I will send you a code fragment
tomorrow! ( with the port 0x80 code and the inline assembly code).

Phil

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019