Jump to content
Sign in to follow this  

Problems with Inpout32.dll to control parallel port

Recommended Posts


I made a circuit to control some relais with the parallel port, but I can't control relay correctly with autoit (it works only in batch (.BAT file))

If I write

#Include <Constants.au3>
Opt("TrayMenuMode", 1)

$DLLFileAndPath = @ScriptDir & "/inpout32.dll"; remove the @ScriptDir & leading backslash if you prefer to keep the DLL in your system directory
$PortAddress = "0x378"; the default LPT1 on most machines

HotKeySet("{ESC}", "esci")

While 1 
    DllCall($DLLFileAndPath, "int", "Out32", "int", $PortAddress, "int", "1000000") //---> I have only 7 relais (i don't know if it is correct)

Func esci()
    DllCall($DLLFileAndPath, "int", "Out32", "int", $PortAddress, "int", "0000000")

It works (It turn on the first relay), but If I try to turn on the fourth relay it turn on the first, the second and the fourth.

The same happen when i try to turn on the fifth relay and with sixth too, but the other ones works!



P.S. Sorry for my English XDXDXD


Share this post

Link to post
Share on other sites

You might try it this way:

$PortAddress = 0x378

DllCall($DLLFileAndPath, "int", "Out32", "short", $PortAddress, "short", 0x80)

Note that actual hex numbers are used instead of strings. For example, 0x378 vice "0x378", and to set bit 7 you want 0x80 vice "10000000". And some Googling around seemed to show those were "short" (16-bit) parameters vice "int" (32-bit).


Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

oooh!!! thanks !!

I understand now, i tryed to put binary but it goes hex ahhahahah

thank you!

I wish you a Good Evening :graduated:

Edited by ZECK

Share this post

Link to post
Share on other sites

You'll want to keep the DLL loaded while working will DLLCalls. I created a UDF based on Phillip Gibbons inpout* DLL+drivers. It includes byte, word, and dword output functions also.

See my

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...