VERSION 5.00 Begin VB.Form Form1 Caption = "Sample0" ClientHeight = 4440 ClientLeft = 60 ClientTop = 450 ClientWidth = 8505 LinkTopic = "Form1" ScaleHeight = 4440 ScaleWidth = 8505 StartUpPosition = 3 'Windows Default Begin VB.Frame Frame1 Caption = "Key" Height = 855 Left = 1440 TabIndex = 19 Top = 360 Width = 5295 Begin VB.PictureBox closedPic Appearance = 0 'Flat AutoSize = -1 'True BackColor = &H80000005& ForeColor = &H80000008& Height = 405 Left = 3600 Picture = "Form1.frx":0000 ScaleHeight = 375 ScaleWidth = 375 TabIndex = 23 Top = 240 Width = 405 End Begin VB.PictureBox openPic Appearance = 0 'Flat AutoSize = -1 'True BackColor = &H80000005& ForeColor = &H80000008& Height = 405 Left = 1440 Picture = "Form1.frx":06FE ScaleHeight = 375 ScaleWidth = 375 TabIndex = 21 Top = 240 Width = 405 End Begin VB.Label Label2 Caption = "Input is Hi/ relay is closed" Height = 375 Left = 2400 TabIndex = 22 Top = 240 Width = 1095 End Begin VB.Label Label1 Caption = "Input is Low/ relay is open" Height = 495 Left = 120 TabIndex = 20 Top = 240 Width = 1215 End End Begin VB.Timer Timer1 Enabled = 0 'False Interval = 1000 Left = 120 Top = 120 End Begin VB.TextBox addrEdit Height = 375 Left = 3840 TabIndex = 18 Text = "Text1" Top = 2400 Width = 975 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 7 Left = 240 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 17 Top = 3240 Width = 375 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 7 Left = 4680 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 16 Top = 3240 Width = 375 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 6 Left = 720 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 15 Top = 3240 Width = 375 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 5 Left = 1200 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 14 Top = 3240 Width = 375 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 4 Left = 1680 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 13 Top = 3240 Width = 375 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 3 Left = 2160 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 12 Top = 3240 Width = 375 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 2 Left = 2640 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 11 Top = 3240 Width = 375 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 1 Left = 3120 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 10 Top = 3240 Width = 375 End Begin VB.PictureBox inPicture AutoSize = -1 'True Height = 375 Index = 0 Left = 3600 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 9 Top = 3240 Width = 375 End Begin VB.CommandButton Command1 Caption = "GO" Height = 495 Left = 3720 TabIndex = 8 Top = 3840 Width = 1095 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 6 Left = 5160 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 7 Top = 3240 Width = 375 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 5 Left = 5640 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 6 Top = 3240 Width = 375 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 4 Left = 6120 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 5 Top = 3240 Width = 375 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 3 Left = 6600 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 4 Top = 3240 Width = 375 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 2 Left = 7080 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 3 Top = 3240 Width = 375 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 1 Left = 7560 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 2 Top = 3240 Width = 375 End Begin VB.PictureBox outPicture AutoSize = -1 'True Height = 375 Index = 0 Left = 8040 ScaleHeight = 315 ScaleWidth = 315 TabIndex = 1 Top = 3240 Width = 375 End Begin VB.ComboBox deviceListCombo Height = 315 Left = 2280 TabIndex = 0 Text = "Combo1" Top = 1680 Width = 3975 End Begin VB.Label Label4 Caption = "Inputs" Height = 255 Left = 1560 TabIndex = 25 Top = 2640 Width = 615 End Begin VB.Label Label3 Caption = "Outputs" Height = 255 Left = 6240 TabIndex = 24 Top = 2640 Width = 735 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim numCards As Integer Dim addresses(0 To 63) As Long Dim baseAddress As Long Dim inByte As Byte Dim outByte As Byte Private Sub Command1_Click() If Command1.Caption = "GO" Then Command1.Caption = "STOP" Timer1.Enabled = True Else Timer1.Enabled = False Command1.Caption = "GO" End If End Sub Private Sub deviceListCombo_Change() addrEdit.Text = Hex(addresses(deviceListCombo.ListIndex)) End Sub Private Sub Form_Load() Dim hKey As Long, dataSize As Long, datatype As Long, n As Long, I As Long, cardsFound As Long Dim Buf(0 To 63) As TPCI_COMMON_CONFIG RegOpenKeyEx HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\NTioPCI\Parameters", 0, KEY_QUERY_VALUE, hKey dataSize = 4 cardsFound = 0 RegQueryValueEx hKey, "NumDevices", 0, datatype, cardsFound, dataSize If cardsFound > 0 Then dataSize = 64 * 64 RegQueryValueEx hKey, "PCICommonConfig", 0, datatype, Buf(0), dataSize End If numCards = 0 For I = 0 To cardsFound - 1 If Buf(I).VendorID = &H494F Then If Buf(I).DeviceID = &HF01 Then deviceListCombo.AddItem Str(numCards) + ": LPCI-IIRO-8", numCards addresses(numCards) = Buf(I).BaseAddresses(2) And &HFFF8 numCards = numCards + 1 End If End If Next I deviceListCombo.AddItem "104-IIRO-8 (Enter Address Below)" addresses(numCards) = &H300 numCards = numCards + 1 baseAddress = addresses(0) addrEdit.Text = Hex(baseAddress) deviceListCombo.ListIndex = 0 inByte = 0 outByte = 0 For I = 0 To 7 outPicture(I).Picture = openPic inPicture(I).Picture = openPic Next I End Sub Private Sub outPicture_Click(Index As Integer) If outPicture(Index).Picture = closedPic.Picture Then outPicture(Index).Picture = openPic.Picture Else outPicture(Index).Picture = closedPic.Picture End If outByte = outByte Xor (2 ^ Index) End Sub Private Sub Timer1_Timer() Dim I As Integer OutPortB baseAddress, outByte inByte = InPortB(baseAddress + 1) For I = 0 To 7 If (inByte And (2 ^ I)) Then inPicture(I).Picture = closedPic Else inPicture(I).Picture = openPic End If Next I End Sub