From owner-freebsd-hackers Thu Apr 19 12:34:34 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id BCC6C37B43C for ; Thu, 19 Apr 2001 12:34:29 -0700 (PDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.11.3/8.11.1) with ESMTP id f3JJYH806407; Thu, 19 Apr 2001 13:34:18 -0600 (MDT) (envelope-from imp@harmony.village.org) Message-Id: <200104191934.f3JJYH806407@harmony.village.org> To: David Miller Subject: Re: [OT] parallel port for IO? Cc: freebsd-hackers@FreeBSD.ORG In-reply-to: Your message of "Fri, 13 Apr 2001 12:38:21 EDT." References: Date: Thu, 19 Apr 2001 13:34:17 -0600 From: Warner Losh Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message 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