Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    4

    Question Unanswered: sending information to parallel port

    i've been trying to figure out how to send info to a parallel port for a while now. i got a few different .dlls and things but i really don't know what i'm doing. my understanding is that it is possible to control 8 of the pins, setting them to either high or low (0 or 1.) i'm trying to figure out how to make my own barmonkey program (if you haven't seen the barmonkey project it's a computer controlled bar, check www.barmonkey.net ) so i'll need 2 parallel ports where valves are basically wired to the pins, the valve will open when the pin is set to high and close when it's low. the code below is as close as i got, but i really don't know how that works at all.




    Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" _
    (ByVal PortAddress As Integer) As Integer

    Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" _
    (ByVal PortAddress As Integer, ByVal Value As Integer)

    For i = 1 To 16
    If txtIngredient(i).Text > 0 Then
    If i <= 8 Then
    Out Port1, i
    Else
    Out Port2, i - 8
    End If
    End If
    Next i

  2. #2
    Join Date
    May 2004
    Posts
    97
    Quote Originally Posted by thirty6
    i've been trying to figure out how to send info to a parallel port for a while now. i got a few different .dlls and things but i really don't know what i'm doing. my understanding is that it is possible to control 8 of the pins, setting them to either high or low (0 or 1.) i'm trying to figure out how to make my own barmonkey program (if you haven't seen the barmonkey project it's a computer controlled bar, check www.barmonkey.net ) so i'll need 2 parallel ports where valves are basically wired to the pins, the valve will open when the pin is set to high and close when it's low. the code below is as close as i got, but i really don't know how that works at all.




    Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" _
    (ByVal PortAddress As Integer) As Integer

    Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" _
    (ByVal PortAddress As Integer, ByVal Value As Integer)

    For i = 1 To 16
    If txtIngredient(i).Text > 0 Then
    If i <= 8 Then
    Out Port1, i
    Else
    Out Port2, i - 8
    End If
    End If
    Next i
    Or you could not reinvent the wheel...

    http://www.hottimesoftware.com/p7.htm

  3. #3
    Join Date
    Nov 2004
    Posts
    4

    but

    i don't want a program that allows me to turn things on and off myself, i want the program to turn things on and off. i've written enough of the program so there a list of drinks with a possible 16 ingredients, a user can choose a drink and click a button that would pour the drink...that button is supposed to set pins to high for whatever amount of time to open the valve and let fluid out of a bottle and into their cup. (that was the simple version) i just need to know how to turn each pin on and off with vb.

  4. #4
    Join Date
    May 2004
    Posts
    97
    The parallel port address is 888
    There are 8 data pins, corresponding to the 8 bits in 00000000


    Declare Sub vbOut Lib "WIN95IO.DLL" (ByVal nPort As Integer, ByVal nData As Integer)
    Declare Sub vbOutw Lib "WIN95IO.DLL" (ByVal nPort As Integer, ByVal nData As Integer)
    Declare Function vbInp Lib "WIN95IO.DLL" (ByVal nPort As Integer) As Integer
    Declare Function vbInpw Lib "WIN95IO.DLL" (ByVal nPort As Integer) As Integer



    vbout 888, 0 'turns all off
    vbout 888, 1 'turns on pin 1 (10000000)
    vbout 888, 2 'turns on pin 2 (01000000)
    vbout 888, 11 'turn on pins 1, 3, and 4 (10110000)


    Get the idea?

Posting Permissions

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