Mail Archives: djgpp/1998/01/30/01:46:10
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 -