Jump to content
Sign in to follow this  
ZECK

Problems with Inpout32.dll to control parallel port

Recommended Posts

ZECK

Hi!

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)
WEnd

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

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!

Thanks,

ZECK

P.S. Sorry for my English XDXDXD

post-61700-0-73501600-1291755294_thumb.j

Share this post


Link to post
Share on other sites
PsaltyDS

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).

:graduated:

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
ZECK

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
Ascend4nt

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.