Results 1 to 6 of 6

Thread: Parallel port relay control in RR using Autoit?

  1. #1
    Constant Bitrate
    Join Date
    Jul 2004
    Posts
    208

    Parallel port relay control in RR using Autoit?

    Hi All,

    So I was thinking yesterday about how nice it would be if I could raise and lower my radio antenna when I switched to the radio skin, (I currently have the antenna connected to my instrument light switch). So I did a bit of ing and found that parallel port relay support is on the todo list for RR, so I'm going to have to wait or come up with something else. In my ing I also found the following

    1. AutoIt has a function that can make use of dll files("DllCall").
    2. There are at least 2 DLLs available that allow for direct control of parallel ports :io.dll and inpout32.dll

    So it seems one should be able to use an autoit script called from RR to control/read the input/output pins on the parallel port. My problem is that I have little skill with programming and have not been able to get the DLLCall function in autoit to work.

    Here is the documentation for the DllCall function and in autoit, and I've been trying to call functions from the io.dll dll. I've tried using various forms of the following without success.

    DllCall("io.dll", "none", "SetPortBit",1,0)

    The 1 above refers to LPT1 and the zero refers to connection D0 on the parallel port... or at least it does in my world. I know the DLL works, because there's a little program out there called Crashes relay control that uses this dll and I'm able to control the the port with this program. Anyone have any ideas on what I'm doing wrong.

    Thanks,

    -momanz
    Carputer installed!!!
    Nlited XP+Minlogon, EpiaM10k, 512mb, Seagate 40 gig 2.5" HD, FM Dlink usb radio, DWL122 USB Wifi, XMD1000 tuner, PT5071 6 amp regulator, Xenarc 700TSV, and 1 ikea key box.

  2. #2
    Constant Bitrate
    Join Date
    Jul 2004
    Posts
    208
    So I couldn't figure out io.dll, but I did manage to get an AutoIt script to control the data pins using inpout32.dll. The command looks like this.

    DllCall( "inpout32.dll", "int", "Out32", "int", 0x378, "int", 1 )

    The last value (1) controls what is written to the port.

    Next I need to figure out how to have RR launch a program when I switch to or leave the radio window, and then I'll take a look at the dreaded flipping of bits during powerup. Anyone want to offer any tips?

    -momanz
    Carputer installed!!!
    Nlited XP+Minlogon, EpiaM10k, 512mb, Seagate 40 gig 2.5" HD, FM Dlink usb radio, DWL122 USB Wifi, XMD1000 tuner, PT5071 6 amp regulator, Xenarc 700TSV, and 1 ikea key box.

  3. #3
    Constant Bitrate
    Join Date
    Jul 2004
    Posts
    208

    Talking

    Ok So I now have a simple autoit script that will toggle a pin on the parallel port (it actually writes to bits D0-D7 but all I'm using at the moment is D0). It looks like this...

    Dim $a[1]
    ;Reads the port and writes the status of the port to the variable $r
    $r = DllCall("inpout32.dll", "int", "Inp32", "int", 0x378)
    If $r[0] = 0 Then
    $a = 1
    Else
    $a = 0
    EndIf
    DllCall( "inpout32.dll", "int", "Out32", "int", 0x378, "int", $a )
    Fairly basic. Now for the boot problem... It ocurred to me that most of the documention on direct access of parallel ports in XP makes a big deal about needing a kernel mode driver as opposed to a user mode driver. So I think what this means is that when you use a dll such as inpout32.dll or io.dll you are bypassing the windows driver architecture and talking directly to the kernel which can directly access hardware.

    So to make a long story short you can disable the windows parallel port driver and eliminate any parallel port polling during bootup or when you resume from hibernation. I disabled my parallel port driver directly by changing the following registry setting.

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Parport

    Change the value of the "START" to 4

    Now when I boot there isn't any windows induced polling of the parallel port, and I can still access the parallel port without the windows driver!

    All that's left is the bios polling, and sadly there is nothing that can be done in software that I can think of, but the signals seem to occurr so quickly that I think using a properly selected capacitor will prevent a relay from switching unless there is voltage applied for a certain period of time.

    -m
    Carputer installed!!!
    Nlited XP+Minlogon, EpiaM10k, 512mb, Seagate 40 gig 2.5" HD, FM Dlink usb radio, DWL122 USB Wifi, XMD1000 tuner, PT5071 6 amp regulator, Xenarc 700TSV, and 1 ikea key box.

  4. #4
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,166
    Blog Entries
    52
    can your script be used or modified to turn on my reverse camera when 12V are applied to the reverse lights? basically lights turn on, camera powers sending a message to the parrellel port that car is in reverse and the proper RR skin should be loaded? How would i find documention on how to wire to the parrallel port?
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  5. #5
    Constant Bitrate
    Join Date
    Jul 2004
    Posts
    208
    What you would need is an application/script running in the background that monitors the parallel port. When it detects a change it would send RR a command to switch to your reverse cam skin. You can define the command as a text string in the ExecTBL.ini. When the script detects that the reverse lights are off you can send a command to RR to close the embedded window.

    A couple of things to consider, I don't know how much of a resource hog autoit scripts are. It may be better to write a proper program/service and have it running in the background. With that said I'm not much of a programmer and I am just getting into customizing and automating my rig.

    Also be very careful connecting anything to your parallel port. It is very easy to damage the port when applying an input or trying to draw too much current. I'll continue to document my progress here and if I get a chance I may try my hand at writing a script that can do what you're after.

    How would i find documention on how to wire to the parrallel port?
    Sorry, I had to do that, the net is littered with documentation on interfacing with a parallel port.

    Try this link
    Carputer installed!!!
    Nlited XP+Minlogon, EpiaM10k, 512mb, Seagate 40 gig 2.5" HD, FM Dlink usb radio, DWL122 USB Wifi, XMD1000 tuner, PT5071 6 amp regulator, Xenarc 700TSV, and 1 ikea key box.

  6. #6
    Constant Bitrate soundoff's Avatar
    Join Date
    Jul 2004
    Location
    AUSTRALIA
    Posts
    192
    any further progress with this? Do you have any troubles during bootup with the parallel port pins switching off and on?

    I also need to control my antenna somehow

Similar Threads

  1. My LPT Relay Control Software
    By wizardPC in forum Software & Software Development
    Replies: 23
    Last Post: 02-13-2005, 12:10 PM
  2. Long Parallel port cable for HD44780
    By Dwiel in forum LCD/Display
    Replies: 2
    Last Post: 04-10-2004, 06:28 AM
  3. Will someone help me program my relay control module
    By cproaudio in forum Software & Software Development
    Replies: 6
    Last Post: 09-04-2002, 04:50 AM
  4. winamp or media player IR remote control for 9 pin serial port $11
    By sfrechet in forum General Hardware Discussion
    Replies: 10
    Last Post: 08-10-2002, 11:02 AM
  5. Program or batch file to control DTR on a serial port
    By percyt2k in forum Software & Software Development
    Replies: 7
    Last Post: 12-17-2001, 03:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •