Sunday 17 June 2012

PC's Pareller Port Input & Out Put VB6 code

Following is the visual basic 6 program code for PC's LPT-1 Port for device controlling.
START MODULE
'//*******************************************************************************
'// LPT-Port.bas (Module)
'// (Learn how to access PC's LPT-1 Port through Visual Basic)
'// Microsoft Visual Basic Ver.6 with Windows XP as OS
'// This program required Driver file "inpout32.dll"
'//-------------------------------------------------------------------------------
'// Learn how to access PS's LPT Port through VB6 with an interface unit)
'// connected at PC's LPT-1 Port
'// Project By Mr Adeeb Raza
'// Allahabad (U.P) INDIA
'// Dated 1st March 2005
'// Email: adeebraza@hotmail.com or adeebraza@areptone.com
'//********************************************************************************
''
'' This has written in Module LPT-Port.bas
''
'' ********************************************************************************
''
'// INPUT
'//******
Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" _
(ByVal address As Integer) _
As Integer
'
'// OUTPUT
'//*******
Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" _
(ByVal address As Integer, _
ByVal Value As Integer)
******************************* End Module **************************************

START
'//*******************************************************************************
'// LPT-Port.vbp (Learn how to access PC's LPT-1 Port through Visual Basic)
'// Microsoft Visual Basic Ver.6 with Windows XP as OS
'// This program required Driver file "inpout32.dll"
'//-------------------------------------------------------------------------------
'// Learn how to access PS's LPT Port through VB6 with an interface unit)
'// connected at PC's LPT-1 Port
'// Project By Mr Adeeb Raza
'// Allahabad (U.P) INDIA
'// Dated 1st March 2005
'// Email: adeebraza@hotmail.com or adeebraza@areptone.com
'//********************************************************************************
''
'' This has written in LPT-Port.VBP with Module LPT-Port.bas
''
'' ********************************************************************************
Option Explicit
Dim AEPPort As Integer
Dim AEPData As Integer
Dim pat, data, portinput, code
'
Sub AEPOut(data As Integer)
Out AEPPort, AEPData
End Sub
Private Sub Command1_Click()
pat = Text1.Text
If pat >= 1 Then GoTo X Else GoTo Y
X:
AEPPort = &H378                  'Input port = Base H378 as (Data Bus)
AEPData = Val(pat)
AEPOut (data)
Label20.Caption = AEPData
Shape1.Visible = True
Shape2.Visible = False
Y:
End Sub
Private Sub Command2_Click()
pat = 0
AEPPort = &H378
AEPData = Val(pat)
AEPOut (data)
Label20.Caption = AEPData
Shape1.Visible = False
Shape2.Visible = True
End Sub
Private Sub Command3_Click()
Unload Form1
Load Form2
Form2.Show
End Sub
Private Sub Command4_Click()
pat = 0
AEPPort = &H378
AEPData = Val(pat)
AEPOut (data)
Label20.Caption = AEPData
End
End Sub
Private Sub Form_Load()
End Sub
Private Sub Timer1_Timer()
AEPPort = &H379                    'Input port = Base+1  as (Status Bus)
Label21.Caption = Inp(AEPPort)
portinput = Label21.Caption
code = portinput - 7               'CODE (Input value - 7) (Status Bus)
Label26.Caption = code
End Sub
********************************** End  **********************************
Screebn Shot of Above Program download http://www.areptone.com/vb6/arlptefy.zip

Thanks
Adeeb Raza