VERSION 5.00 Begin VB.Form Sample1Form Caption = "Sample 1" ClientHeight = 4020 ClientLeft = 6330 ClientTop = 5955 ClientWidth = 6555 LinkTopic = "Form1" ScaleHeight = 268 ScaleMode = 3 'Pixel ScaleWidth = 437 Begin VB.Frame Frame1 Caption = "Input" Height = 960 Left = 120 TabIndex = 7 Top = 2124 Width = 6276 Begin VB.Label Label3 Alignment = 2 'Center Caption = "Port 0" Height = 192 Left = 240 TabIndex = 13 Top = 240 Width = 1788 End Begin VB.Label Label5 Alignment = 2 'Center Caption = "Port 2" Height = 192 Left = 4320 TabIndex = 12 Top = 240 Width = 1788 End Begin VB.Label Label4 Alignment = 2 'Center Caption = "Port 1" Height = 192 Left = 2280 TabIndex = 11 Top = 240 Width = 1788 End Begin VB.Label PortPanel Alignment = 2 'Center BorderStyle = 1 'Fixed Single Caption = "0000000000000000" Height = 252 Index = 1 Left = 2280 TabIndex = 10 Top = 480 Width = 1788 End Begin VB.Label PortPanel Alignment = 2 'Center BorderStyle = 1 'Fixed Single Caption = "0000000000000000" Height = 252 Index = 2 Left = 4320 TabIndex = 9 Top = 480 Width = 1788 End Begin VB.Label PortPanel Alignment = 2 'Center BorderStyle = 1 'Fixed Single Caption = "0000000000000000" Height = 252 Index = 0 Left = 240 TabIndex = 8 Top = 480 Width = 1788 End End Begin VB.Timer TestTimer Enabled = 0 'False Interval = 100 Left = 4440 Top = 3480 End Begin VB.Frame BaseAddressBox Caption = "Base Address for ISA Card" Height = 768 Left = 300 TabIndex = 4 Top = 3180 Width = 2256 Begin VB.TextBox BaseEdit Height = 288 Left = 1200 TabIndex = 6 Text = "300" Top = 320 Width = 852 End Begin VB.Label Label2 Caption = "Base Address:" Height = 192 Left = 120 TabIndex = 5 Top = 360 Width = 1068 End End Begin VB.CommandButton ExitButton Caption = "Exit Program" Height = 372 Left = 4800 TabIndex = 3 Top = 3456 Width = 1440 End Begin VB.CommandButton TestButton Caption = "Start Test" Height = 372 Left = 2880 TabIndex = 2 Top = 3456 Width = 1440 End Begin VB.TextBox Text1 BackColor = &H8000000F& Height = 1668 Left = 120 Locked = -1 'True MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 1 Text = "Sample1u.frx":0000 Top = 360 Width = 6276 End Begin VB.Label Label1 Alignment = 2 'Center AutoSize = -1 'True Caption = "IDI-48" BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 0 TabIndex = 0 Top = 0 Width = 6456 End End Attribute VB_Name = "Sample1Form" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function InPortB Lib "ACCES32" Alias "VBInPortB" (ByVal Port As Long) As Integer Private Declare Function OutPortB Lib "ACCES32" Alias "VBOutPortB" (ByVal Port As Long, ByVal Value As Byte) As Integer Private Declare Function InPort Lib "ACCES32" Alias "VBInPort" (ByVal Port As Long) As Integer Dim Address As Integer Private Sub ExitButton_Click() End End Sub Private Sub Form_Load() If (InPortB(&H61) = &HAA55) Then Call MsgBox("ACCESNT.SYS not detected. Please copy ACCESNT.SYS into [NT]/system32/drivers and re-run this sample.", 0, "Warning") End If End Sub Private Sub TestButton_Click() If TestTimer.Enabled Then TestTimer.Enabled = False TestButton.Caption = "Start Test" BaseEdit.Enabled = True Else TestTimer.Enabled = True TestButton.Caption = "Abort Test" Address = "&h" + Sample1Form.BaseEdit.Text BaseEdit.Enabled = False End If ' end if/else End Sub Private Sub TestTimer_Timer() Dim Port, i As Integer Dim data As Long Dim mask As Long Dim ofs 'As Integer ofs = Array(0, 1, 2, 4, 5, 6) ' Table of offsets to input registers PortPanel(0).Caption = "" PortPanel(1).Caption = "" PortPanel(2).Caption = "" For Port = 0 To 2 ' Read the 16 input channels of current port data = (InPortB(Address + ofs(2 * Port)) And &HFF) data = data + (InPortB(Address + ofs((2 * Port) + 1)) And &HFF) ' Check the status of each bit field and display result mask = 1 For i = 0 To 15 If (mask And data) Then PortPanel(Port).Caption = "1" + PortPanel(Port).Caption Else PortPanel(Port).Caption = "0" + PortPanel(Port).Caption End If mask = mask * 2 Next ' end for i Next ' end for port End Sub