Private Sub Form_Load() 'Place this code in the Form_Load routine of your application's startup form. 'Search for the "USBSIMM1" hardware. If OpenUSBdevice("USBSIMM1v1.0") Then 'If the hardware is found, pass control to the application's main form Form1.Show (1) End If End Sub Private Sub SetPortAToInput() 'Set all of the lines of Port A to input. Dim OutBuffer(10) As Byte OutBuffer(0) = 73 ' Port A direction command OutBuffer(1) = &H0 ' 0 is input Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) End Sub Private Sub SetPortAToOutput() 'Set all of the lines of Port A to output. Dim OutBuffer(10) As Byte OutBuffer(0) = 73 ' Port A direction command OutBuffer(1) = &HFF ' 1 is output Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) End Sub Private Sub SetPortBToInput() 'Set all of the lines of Port B to input. Dim OutBuffer(10) As Byte OutBuffer(0) = 74 ' Port B direction command OutBuffer(1) = &H0 ' 0 is input Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) End Sub Private Sub SetPortBToOutput() 'Set all of the lines of Port B to output. Dim OutBuffer(10) As Byte OutBuffer(0) = 74 ' Port B direction command OutBuffer(1) = &HFF ' 1 is output Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) End Sub Private Function ReadPortA() As Byte Dim OutBuffer(10) As Byte Dim InBuffer(10) As Byte OutBuffer(0) = 69 ' Read Port A command Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) Call ReadUSBdevice(AddressFor(InBuffer(0)), 6) ReadPortA = InBuffer(1) End Function Private Function ReadPortB() As Byte Dim OutBuffer(10) As Byte Dim InBuffer(10) As Byte OutBuffer(0) = 70 ' Read Port B command Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) Call ReadUSBdevice(AddressFor(InBuffer(0)), 6) ReadPortB = InBuffer(1) End Function Private Sub WriteToPortA(ByteToWrite As Byte) Dim OutBuffer(10) As Byte OutBuffer(0) = 65 ' Write Port A command OutBuffer(1) = ByteToWrite Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) End Sub Private Sub WriteToPortB(ByteToWrite As Byte) Dim OutBuffer(10) As Byte OutBuffer(0) = 66 ' Write Port B command OutBuffer(1) = ByteToWrite Call WriteUSBdevice(AddressFor(OutBuffer(0)), 6) End Sub Listing 1. Use these routines with the provided support files to detect the USBSimm and read and write to its ports.