From owner-freebsd-questions Thu Oct 30 15:38:19 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA21055 for questions-outgoing; Thu, 30 Oct 1997 15:38:19 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from sv.compuland.com.br (sv.compuland.com.br [200.255.96.21]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA21030 for ; Thu, 30 Oct 1997 15:38:11 -0800 (PST) (envelope-from coelho@sv.compuland.com.br) Received: from clpc1.compuland.com.br (clpc1.compuland.com.br [200.255.96.22]) by sv.compuland.com.br (8.8.8/8.8.8) with SMTP id VAA22350 for ; Thu, 30 Oct 1997 21:37:55 -0200 (EDT) Message-Id: <199710302337.VAA22350@sv.compuland.com.br> Comments: Authenticated sender is From: coelho@compuland.com.br To: questions@freebsd.org Date: Thu, 30 Oct 1997 21:38:21 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Help to read parallel port Reply-to: coelho@compuland.com.br Priority: normal X-mailer: Pegasus Mail for Win32 (v2.54) Sender: owner-freebsd-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi: I need to convert this c++ code, originally made for Linux. It reads the parallel port. I want to set up a termometer, using a inexpensive sensor. My problem is that and the function ioperm, to open the lpt port... Anyone has a tip ? What direction to do the same on a FreeBSD box ? Thanks a lot! Regards, Helio. #include #include #define BASEPORT 0x3bc /* lp0 */ int main() { /* Get access to parallelport */ if (ioperm(BASEPORT,3,1)) {perror("ioperm");exit(1);} long result, numsamples, i; double temperature, offset, dutycycle; numsamples=1000000; // one million samples result=0; for (i=0;i> 6)+result; // bit-and with 0100000 (get level from pin 11 of statusreg.) // and shift right 6 steps, then add the number to result. }