Reading parallel port status pins with DeviceIOControl()

M

Marven Lee

Hello all,

I've been writing a slot car lap counter in C# and currently
use the inpout32.dll to read the parallel port status pins
that are connected to lane sensors.

I wondered if there was a way of doing it without inpout32.dll
and found that I could get the status of some pins using
DeviceIOControl() and IOCTL_PAR_QUERY_INFORMATION
control code.

I've been connecting the status pins to ground
or letting them float high (don't have a 5v power source)
and watched what happened.

Pin 12 (Paper-Out) sets PARALLEL_PAPER_EMPTY
Pin 13 (Select) sets PARALLEL_SELECTED

Both of the aboce work but:

Pin 11 (Busy) doesn't seem to return anything, not even
PARALLEL_BUSY. Is there any way to read this pin?

Pin 10 (Ack) doesn't have a corresponding code, so I guess
that is unreadable.

Pin 15 (Error) - This doesn't normally float high on the PC I
am using so tried getting 5v from one of the data output pins.
When this is high it appears to set PARALLEL_POWER_OFF,
is this correct?

I copied the values from Ntddpar.h, are these likely to remain
the same for user applications?

I could continue using inpout32.dll but would like to support
USB to Parallel adapters as well so thought using
DeviceIOControl() would be a better choice.
 
D

Deanna Earley

[...]
I could continue using inpout32.dll but would like to support
USB to Parallel adapters as well so thought using
DeviceIOControl() would be a better choice.

Unfortunately, there is really nothing at all in your question that has
anything whatsoever to do with C#.

At the very least, you really should be asking in a general unmanaged
Windows API forum, and really since you're diving into the low-level,
hardware-level behavior you probably want a forum even more specialized
than that.

It was cross posted to (and your reply appeared in)
comp.os.ms-windows.programmer.win32

--
Dee Earley ([email protected])
i-Catcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
 
M

Marven Lee

Peter said:
Deanna said:
[...]
At the very least, you really should be asking in a general unmanaged
Windows API forum, and really since you're diving into the low-level,
hardware-level behavior you probably want a forum even more specialized
than that.

It was cross posted to (and your reply appeared in)
comp.os.ms-windows.programmer.win32

Yes, and I'd say the lack of even _any_ reply from that newsgroup confirms
my suggestion that the OP needs a completely different forum than either
this C# newsgroup (where the question is completely off-topic and should
never have been posted) or the c.o.m.p.win32 newsgroup (where it's
nominally on-topic, but esoteric enough to find a lack of help anyway).

I cross posted it to the csharp group as I was also going to ask a
question regarding marshalling of structures when I called win32
functions but had left that out as I seem to have it working.
Sorry about that. You are right that other groups, maybe
kernel mode or device drivers would've been more
relavant place to ask but wasn't sure.

I'll stick with what I've learnt about the parallel port status pins
so far but will do a bit more searching or stick to using inpout32.dll
for parallel port access.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top