S
S
Sicness2012-10-02 13:06:53
Do it yourself
Sicness, 2012-10-02 13:06:53

Work with LPT port directly

Based on the article Lamp Control via the Internet, I am collecting something similar. But I ran into a problem, the solution of which I can not find for several days. I really hope for a hint or an idea ... The situation is this:
I took only 2 pins from LPT: D0 (2) and GND (3). Connected through a 300 ohm resistor to a 4N35 optocoupler. The optocoupler in my case acts as a key that closes / opens the external circuit (in terms of putting it parallel to the button on the wall). As a test, the controlled circuit is now commonplace: 5V - R (300 Ohm) - LED - GND. That is the most simple scheme.
The result is the following: when the PC is turned on, the target LED lights up as expected. But as soon as control is transferred to the OS, the LED goes out and nothing can light it up anymore (when rebooting, the OS is on before control is transferred). To work with LPT programmatically, I tried everything I found.
inpout32.dll in both python and C;
giveio.sys with pyparaller
Other special drivers and special programs.

There is only one result: it is written to the port (0x378, I checked with myself, this address really is), the written value is read from this memory cell, all tests pass OK, but the LED does not light up. At the same time, it is lit while you are in the BIOS. Tried in Windows 7, Windows XP, Ubuntu and on 2 different systems.
I have already read a lot about this, nothing helps. I'm clearly missing something.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Atxmega, 2012-10-03
@Atxmega

I recommend 100% working option. HiAsm
Put the button and LPT there and that's it.
Earth is really 18-25, but not all! put them all together.
To check, put an LED and a resistor.
If there is a problem to control the state when the computer turns on, please contact me, I will prompt.

Z
Zak, 2012-10-02
@Zak

I recommend discarding the entire circuit for a while and using a tester (multimeter) or an oscilloscope to measure the levels on the LPT itself, depending on the values ​​​​written to the port. The easiest way to do this is by taking code examples from libraries for working with LPT.

A
Alexander Sharihin, 2012-10-03
@Pinsky

Check, no drivers are monitoring the port besides you?

A
Alexander Sharihin, 2012-10-03
@Pinsky

It immediately seemed that something was wrong.
The 3rd pin is D1, not earth.
The earths go from 18 to 25 pins.

E
elgordo, 2012-12-28
@elgordo

I used similar solutions and everything worked for me. In the BIOS, you can also try switching the port mode, there are 3 modes. It worked for me under Windows 2000 and Windows XP, but I don't remember which ones I used. In general, Windows does not allow direct access to ports and a driver is needed that bypasses this limitation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question