Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Apr 2001 13:34:17 -0600
From:      Warner Losh <imp@harmony.village.org>
To:        David Miller <dmiller@sparks.net>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: [OT] parallel port for IO? 
Message-ID:  <200104191934.f3JJYH806407@harmony.village.org>
In-Reply-To: Your message of "Fri, 13 Apr 2001 12:38:21 EDT." <Pine.BSF.4.21.0104131235110.97924-100000@search.sparks.net> 
References:  <Pine.BSF.4.21.0104131235110.97924-100000@search.sparks.net>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.BSF.4.21.0104131235110.97924-100000@search.sparks.net> David Miller writes:
: Anyone know of a way to get a low cost port of some kind to to simple
: state change detection?  The specific purpose is to time external events
: which are triggered by breaking an LED light beam.  Millisecond resolution
: would be fine.
: 
: I was thinking of sampling the parallel port repeatedly and looking for
: data lines to be high or low.  Feasible?

If you have only 1 source, then you can use the ack line of the
parallel port and the ppi driver to get timestamped events.  If you
have more than one, then you might be able to wire a simple latch to
the ACK line and sample of to 8 sources.  That's trickier as their's
some hair in converting the signals to pulses, worrying about races,
etc.  1 source gives you nanosecond resolution (but only ms accuracy
due to interrupt latencies, us if you hack it to be a fast interrupt).
N sources gets dicier, and I don't even want to think about it.

You likely could also create a driver similar to the ppi driver that
polled the parallel port every tick.  This would give you approx 10ms
accuracy and resolution, assuming that HZ is 100.  Not sure how far
you could push this technique.

Warner


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104191934.f3JJYH806407>