RE:Manejo de Puerto Paralelo
En la misma carpeta q tengas el proyecto pones la io.DLL y pones:
Esto va en el módulo bas
Public Declare Sub PortOut Lib "io.dll" (ByVal Port As Integer, ByVal Data As Byte)
Public Declare Sub PortWordOut Lib "io.dll" (ByVal Port As Integer, ByVal Data As Integer)
Public Declare Sub PortDWordOut Lib "io.dll" (ByVal Port As Integer, ByVal Data As Long)
Public Declare Function PortIn Lib "io.dll" (ByVal Port As Integer) As Byte
Public Declare Function PortWordIn Lib "io.dll" (ByVal Port As Integer) As Integer
Public Declare Function PortDWordIn Lib "io.dll" (ByVal Port As Integer) As Long
Public Declare Sub SetPortBit Lib "io.dll" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub ClrPortBit Lib "io.dll" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub NotPortBit Lib "io.dll" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Function GetPortBit Lib "io.dll" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
Public Declare Function RightPortShift Lib "io.dll" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Public Declare Function LeftPortShift Lib "io.dll" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Public Declare Function IsDriverInstalled Lib "io.dll" () As Boolean
Public lpt1 As String
------------------------------------------------------------
'Esto va en el Form
Private Sub Command1_Click()
'------------------CONVERSIONES----------------------------------
'------------------BINARIO A DECIMAL-----------------------------
'CONVERTIR LPT1
total1 = 0
lpt1 = Text1.Text
If Mid(lpt1, 1, 1) = "1" Then total1 = (1 * 2) ^ 7
If Mid(lpt1, 2, 1) = "1" Then total1 = total1 + ((1 * 2) ^ 6)
If Mid(lpt1, 3, 1) = "1" Then total1 = total1 + ((1 * 2) ^ 5)
If Mid(lpt1, 4, 1) = "1" Then total1 = total1 + ((1 * 2) ^ 4)
If Mid(lpt1, 5, 1) = "1" Then total1 = total1 + ((1 * 2) ^ 3)
If Mid(lpt1, 6, 1) = "1" Then total1 = total1 + ((1 * 2) ^ 2)
If Mid(lpt1, 7, 1) = "1" Then total1 = total1 + ((1 * 2) ^ 1)
If Mid(lpt1, 8, 1) = "1" Then total1 = total1 + ((1 * 2) ^ 0)
PortOut &H378, total1
Label5.Caption = total1
End Sub
Private Sub Command2_Click()
PortOut &H378, 0
End
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label5.Caption = "Esperando una Entrada"
End Sub
Private Sub Timer1_Timer()
'------------------DECIMAL A BINARIO-----------------------------
Dim i As Long, J As Long, K As Long, A As Long, H As Long
Dim Cadena
On Error Resume Next
A = PortIn(&H379)
For J = 7 To 0 Step -1
If A And 2 ^ J Then
H = 1
Else
H = 0
End If
Cadena = Cadena & H
Label49.Caption = Cadena
Next
Text2.Text = Cadena
Text3.Text = PortIn(&H379)
End Sub