Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading & writing parallel port data and setting it on or off

18 views
Skip to first unread message

John Smith

unread,
Sep 20, 2008, 11:32:33 AM9/20/08
to
I am trying to do some simple data acquisition using the parallel port. I
downloaded impout32.dll and have used it successfully to

Here is a simple sample using the dll:

x = Inp32(0x378); //read data from LPT1
printf("Port read = %04X\n",x);
x=0x01;
/// Write the data register
Out32(0x378,x); //it's now ON

What I would like to do is change the value at 0x378 to, say, zero EXTERNALLY.
How do I do it? Do I short some pins, use a current? There a lot of stuff on
reading and setting the value using a program but I can't find a simple example
on how to set the value using an outside source.

Bob Masta

unread,
Sep 21, 2008, 8:25:10 AM9/21/08
to

It looks from your example like your DLL is using
bidirectional mode, where the same 8 pins can be
either inputs or outputs under your command.
It sounds like what you really want is to be able
to keep these pins as outputs and use some *other*
pins to provide the input control.

Does the driver allow you to set different modes?
If so, set it to the original default mode (forget
what the acronym is now). That uses the data pins
as outputs only, and used other pins at the
next-higher address (0x379 in your example) as
inputs for status information. Note, however,
that there are not 8 "normal" input pins.

Assuming you have a standard DB25 connector, the
Status port at 0x379 is mapped like this:

Bit Pin
0 unused
1 unused
2 unused
3 15
4 13
5 12
6 10
7 11 (INVERTED)

So you see, you can only get 5 bits of input data
through the Status port...and even there you need
to invert one of them. "Back in the day", input
schemes transferred 4 data bits at a time, and
used the 5th to tell whether it was the low or
high nybble.

Alternatively, you can use the Control port at
0x3FA (in your case) to get a few more bits. This
port is read/write, and can be a bit trickier to
use. I don't have the pinout at hand, but I'm
sure it's on the Web somewhere.

Best regards,


Bob Masta

DAQARTA v4.00
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
FREE Signal Generator
Science with your sound card!

0 new messages