Professional Documents
Culture Documents
The diagram below shows the parallel port and what all of the pins do. For our current purposes, we only need pins 2-9 and pins 18-25.
positive side of a LED into pins 2-9 on your parallel port and the negative side of the LED into pins 1825.
Ok, as I stated above, Visual Basic doesnt provide any direct access to the parallel port. So, we will have to declare the functions that we will need to use from the INPOUT32.dll.
Declaration for parallel Port in VB6. Private Declare Function Inp Lib "inpout32.dll" _ Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Private Declare Sub Out Lib "inpout32.dll" _ Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
2^8
Decimal #
2^7
2^6 64
2^5 32
2^4 16
2^3 8
2^2 4
2^1 2
2^0 1
LED
LED 7 on
LED 6 on
LED 5 on
LED 4 on
LED 3 on
LED 2 on
LED 1 on
Private Sub cmdswitch1_Click() Out PortAddress, 1 only LED1 turns On End Sub
Private Sub cmdswitch6_Click() Out PortAddress, 32 End Sub only LED5 turns On
Private Sub cmdswitchd2_Click() Out PortAddress, 2 only LED2 turns On End Sub
Private Sub cmdswitch3_Click() Out PortAddress, 4 only LED3 turns On End Sub
End Sub
End Sub
Private Sub cmdswitchd2_Click() Out PortAddress, 2 only LED2 turns On End Sub Private Sub cmdswitch3_Click() Out PortAddress, 4 only LED3 turns On End Sub Private Sub cmdswitch4_Click() Out PortAddress, 8 only LED3 turns On End Sub Private Sub Command5_Click() Out PortAddress, 16 only LED4 turns On End Sub
Private Sub cmdswitch7_Click() Out PortAddress, 64 only LED6 turns On End Sub
Private Sub cmdswitch8_Click() Out PortAddress, 128 only LED7 turns On End Sub
Private Sub cmdswitch9_Click() Out PortAddress, 0 all LED turn OFF End Sub