Tech Support > Microsoft Windows > Development Resources > parallel - DOS - XP
parallel - DOS - XP
Posted by Rick Merrill on December 2nd, 2003


When I program _inp and _outp in C to run
under DOS to access the parallel port, it
writes a pattern to LPT1 and reads it back.
On an outgoing parallel port this is supposed
to work reliably (modern port). BUT in a DOS
window under XP it only works SOMETIMES.
(there is NOTHING plugged in)

What could be going on here? (excluding sun spots) - RM

Posted by Tim Robinson on December 2nd, 2003


Windows XP emulates the parallel port for DOS applications. What you are
seeing is not the real parallel port (since direct port access isn't
available to applications), but NTVDM's emulation of it.

--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Rick Merrill" <RickMerrill@comTHROW.net> wrote in message
news:7G5zb.201536$Dw6.745489@attbi_s02...


Posted by Rick Merrill on December 2nd, 2003


Tim Robinson wrote:

I was aware of the emulator, but I could not imagine why

_outp(LPT1, 0xAA);
x = _inp(LPT1);
i++;
if (x!= 0xAA) printf ...i

"prints" most of the time! Are other drivers sometimes taking
over the output port? - RM



Posted by Tõnu Aas on December 3rd, 2003


Maybe your LPT is in bidirectional mode.

Tõnu.



Posted by Rick Merrill on December 3rd, 2003


Tõnu Aas wrote:

Good thought, but I initialize the Control register
with zero which should force it to output only. HOWEVER,
I can't be sure :-)



Posted by Tim Robinson on December 3rd, 2003


Because the NTVDM emulation works for printing documents to the parallel
port, but not for your custom device (how could it?).

The only reasonable way of interfacing directly to such a device on XP would
be to write a kernel-mode driver for it. http://www.microsoft.com/ddk/

--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Rick Merrill" <RickMerrill@comTHROW.net> wrote in message
news:ZP7zb.397277$HS4.3209413@attbi_s01...


Posted by Rick Merrill on December 4th, 2003


Tim Robinson wrote:

Thanks Tim.

(Pretty clever use of top posting and a sig file, by the way:-)
--
RM


Posted by Tim Robinson on December 4th, 2003


"Rick Merrill" <RickMerrill@comTHROW.net> wrote in message
news:8SLzb.301779$9E1.1527480@attbi_s52...
Bah, not really. It's just random .

--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/




Similar Posts