VERSION 5.00 Begin VB.Form Cc Caption = "Form1" ClientHeight = 6345 ClientLeft = 5955 ClientTop = 4815 ClientWidth = 6450 LinkTopic = "Form1" ScaleHeight = 6345 ScaleWidth = 6450 Begin VB.Timer RunTimer Enabled = 0 'False Interval = 500 Left = 120 Top = 4080 End Begin VB.CheckBox ChannelCheck Caption = "Channel 7" Height = 255 Index = 7 Left = 4560 TabIndex = 35 Top = 3600 Width = 1215 End Begin VB.CheckBox ChannelCheck Caption = "Channel 6" Height = 255 Index = 6 Left = 4560 TabIndex = 34 Top = 3360 Width = 1215 End Begin VB.CheckBox ChannelCheck Caption = "Channel 5" Height = 255 Index = 5 Left = 4560 TabIndex = 33 Top = 3120 Width = 1215 End Begin VB.CheckBox ChannelCheck Caption = "Channel 4" Height = 255 Index = 4 Left = 4560 TabIndex = 32 Top = 2880 Width = 1215 End Begin VB.CheckBox ChannelCheck Caption = "Channel 3" Height = 255 Index = 3 Left = 3200 TabIndex = 31 Top = 3600 Width = 1215 End Begin VB.CheckBox ChannelCheck Caption = "Channel 2" Height = 255 Index = 2 Left = 3200 TabIndex = 30 Top = 3360 Width = 1215 End Begin VB.CheckBox ChannelCheck Caption = "Channel 1" Height = 255 Index = 1 Left = 3200 TabIndex = 29 Top = 3120 Width = 1215 End Begin VB.TextBox DataText Height = 300 Index = 7 Left = 5230 TabIndex = 27 Top = 5160 Width = 570 End Begin VB.TextBox DataText Height = 300 Index = 6 Left = 4560 TabIndex = 26 Top = 5160 Width = 570 End Begin VB.TextBox DataText Height = 300 Index = 5 Left = 3900 TabIndex = 25 Top = 5160 Width = 570 End Begin VB.TextBox DataText Height = 300 Index = 4 Left = 3260 TabIndex = 24 Top = 5160 Width = 570 End Begin VB.TextBox DataText Height = 300 Index = 3 Left = 2590 TabIndex = 23 Top = 5160 Width = 570 End Begin VB.TextBox DataText Height = 300 Index = 2 Left = 1920 TabIndex = 22 Top = 5160 Width = 570 End Begin VB.TextBox DataText Height = 300 Index = 1 Left = 1270 TabIndex = 21 Top = 5160 Width = 570 End Begin VB.Frame DataFrame Height = 1215 Left = 480 TabIndex = 11 Top = 4680 Width = 5535 Begin VB.TextBox DataText Height = 300 Index = 0 Left = 120 TabIndex = 20 Top = 480 Width = 570 End Begin VB.Label Label16 Caption = "Ch 7" Height = 255 Left = 4800 TabIndex = 19 Top = 240 Width = 495 End Begin VB.Label Label15 Caption = "Ch 6" Height = 255 Left = 4130 TabIndex = 18 Top = 240 Width = 495 End Begin VB.Label Label14 Caption = "Ch 5" Height = 255 Left = 3460 TabIndex = 17 Top = 240 Width = 495 End Begin VB.Label Label13 Caption = "Ch 4" Height = 255 Left = 2800 TabIndex = 16 Top = 240 Width = 495 End Begin VB.Label Label12 Caption = "Ch 3" Height = 255 Left = 2180 TabIndex = 15 Top = 240 Width = 495 End Begin VB.Label Label11 Caption = "Ch 2" Height = 255 Left = 1500 TabIndex = 14 Top = 240 Width = 615 End Begin VB.Label Label10 Caption = "Ch 1" Height = 255 Left = 840 TabIndex = 13 Top = 240 Width = 495 End Begin VB.Label Label9 Caption = "Ch 0" Height = 255 Left = 160 TabIndex = 12 Top = 240 Width = 495 End End Begin VB.CommandButton ExitButton Caption = "Exit Program" Height = 375 Left = 3840 TabIndex = 10 Top = 4200 Width = 1575 End Begin VB.CommandButton DataButton Caption = "Get Data" Height = 375 Left = 840 TabIndex = 9 Top = 4200 Width = 1575 End Begin VB.Frame SetupFrame Height = 1695 Left = 480 TabIndex = 1 Top = 2280 Width = 5415 Begin VB.CheckBox ChannelCheck Caption = "Channel 0" Height = 255 Index = 0 Left = 2710 TabIndex = 28 Top = 600 Width = 1215 End Begin VB.TextBox BaseEdit Height = 375 Left = 600 TabIndex = 3 Text = "300" Top = 480 Width = 975 End Begin VB.Label Label4 Caption = "Channels" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 2650 TabIndex = 4 Top = 240 Width = 1095 End Begin VB.Label Label3 Caption = "Base Address (hex)" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 240 TabIndex = 2 Top = 240 Width = 1935 End End Begin VB.Label Label8 Caption = "to display the data." BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 600 TabIndex = 8 Top = 1800 Width = 2895 End Begin VB.Label Label7 Caption = "address and channels to read. Click ""Get Data""" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 600 TabIndex = 7 Top = 1560 Width = 5295 End Begin VB.Label Label6 Caption = "and displays the data onscreen. Enter the base" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 600 TabIndex = 6 Top = 1320 Width = 5295 End Begin VB.Label Label5 Caption = "This program reads from selected channels" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 600 TabIndex = 5 Top = 1080 Width = 5055 End Begin VB.Label Label1 Caption = "PAD128 Visual Basic Sample" BeginProperty Font Name = "MS Sans Serif" Size = 18 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 720 TabIndex = 0 Top = 360 Width = 4935 End End Attribute VB_Name = "Cc" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function InPortB Lib "ACCES32.dll" Alias "VBInPortB" (ByVal Port As Long) As Integer Private Declare Function InPort Lib "ACCES32.dll" Alias "VBInPort" (ByVal Port As Long) As Integer Private Declare Function OutPortB Lib "ACCES32.dll" Alias "VBOutPortB" (ByVal Port As Long, ByVal value As Byte) As Integer Private Declare Function OutPort Lib "ACCES32.dll" Alias "VBOutPort" (ByVal Port As Long, ByVal value As Long) As Integer Dim base As Long Dim buffer(255) As Variant Private Sub STARTCONVERSION() Call OutPort(base + 16, 1) End Sub Private Sub RESET() Call OutPort(base + 16, 2) End Sub Private Sub CALIBRATE() Call OutPort(base + 16, 8) End Sub Private Sub SETCHANNEL() Dim offset As Long Dim val As Long Dim loopval As Long Dim i As Byte offset = 0 val = 0 loopval = 0 For i = 0 To 7 If ChannelCheck(i).value = 1 Then Call OutPort(base + offset, val) offset = offset + 2 loopval = val End If val = val + 4 Next i offset = offset - 2 Call OutPort(base + offset, loopval + 1) End Sub Private Sub DataButton_Click() base = "&h" + BaseEdit.Text RESET CALIBRATE If RunTimer.Enabled Then RunTimer.Enabled = False DataButton.Caption = "Get Data" Else RunTimer.Enabled = True DataButton.Caption = "Stop Data" End If End Sub 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 RunTimer_Timer() conv = 0 RESET SETCHANNEL RESET STARTCONVERSION For x = 0 To 7 If ChannelCheck(x).value = 1 Then 'if box checked buffer(x) = InPort(base + 24) And &HFFF 'read data into buffer if box checked End If Next x For t = 0 To 7 If ChannelCheck(t).value = 1 Then 'if box checked DataText(t).Text = " " + Hex(buffer(t)) 'display data read above Else DataText(t).Text = " " End If Next t End Sub