Visual Basic 2008 Express - Parallel Port programming

Discussion in 'Programmer's Corner' started by lkwah86, Mar 17, 2010.

  1. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    I'm just a beginner in VB.

    I need to know how to control the parallel port through the USB to parallel converter. Anyone able to advise me?

    OS - Windows 7
    VB - Visual Basic 2008 Express

    In my device manager, it show the converter as 'USB printing support'. Is it the driver problem?
    I have downloaded DllPort.dll and placed it in 'System32' folder.

    Module Module1
    Public Declare Sub Out Lib "DllPort.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
    End Module

    Public Class Form1

    Dim PortData
    Const AddressLPT1 = &H378

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Call Out(AddressLPT1, &H0)
    End Sub
    End Class
     
    Last edited: Mar 17, 2010
  2. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    I test the coding. No error. but still can't output the data.

    The parallel port's pin1-13 have voltage around 4.7V and pin 14-25 are 0V.
     
  3. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Does Windows 7 support direct control of I/O ports? I think that DLL is for an older operating system like XP. A VB programmers forum might offer more insight. Legacy ports are disappearing fast from computers.
     
  4. CVMichael

    Senior Member

    Aug 3, 2007
    416
    17
  5. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    Thanks for helping... I had tried on XP too... but seem like doesn't work also... = =
    I think is the USB to parallel converter problem, it can't access by the laptop
     
  6. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    Is the USB to parallel adapter just an assumed parallel port?
    If need to interface between the computer and hardware, it should use a real parallel port?
     
  7. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Yes, you should use a real parallel port. The parallel port can source less current than a usb port. so if you build something to use a parallel port, and someone uses it on a REAL parallel port, you can break their PC. (At least the port)

    The usb can source 500mA where a parallel port can usually source/sink about 9-20mA

    [ed]
    Here is some useful info on the subject:
    http://www.beyondlogic.org/spp/parallel.htm
    [/ed]
     
    Last edited: Mar 18, 2010
  8. Harrington

    New Member

    Dec 19, 2009
    86
    3
    Ive had problems with this as well using the parallel port with the dll as specified on xp what i found is that the port is constantly interrogated by the OS which gives you false results I don't really know what Microsoft have done here but I can only get this to work in a fashion without having to write parallel port drivers for the hardware My guess is they have done this deliberately, which ,well sounds like typical Bill Gates this ruined peoples ordinary fun The way round this is to dual boot either into dos in which case you can use ordinary C or else its back to Linux

    I don't know what other people have found but they were my findings Not very nice still there you go typical this
     
Loading...