VERSION 5.00 Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx" Begin VB.Form Sample0Form Caption = "Sample 0" ClientHeight = 6885 ClientLeft = 6675 ClientTop = 4530 ClientWidth = 6030 LinkTopic = "Form1" ScaleHeight = 459 ScaleMode = 3 'Pixel ScaleWidth = 402 Begin VB.CommandButton ExitButton Caption = "E&xit Program" Height = 375 Left = 4440 TabIndex = 8 Top = 6000 Width = 1455 End Begin VB.CommandButton TestButton Caption = "Start Test" Height = 375 Left = 2760 TabIndex = 7 Top = 6000 Width = 1455 End Begin VB.Frame BaseAddressFrame Caption = "Base Address for PC/104 Card" Height = 855 Left = 120 TabIndex = 4 Top = 5760 Width = 2415 Begin VB.TextBox BaseEdit Height = 315 Left = 960 TabIndex = 5 Text = "300" Top = 360 Width = 855 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Hex:" Height = 195 Left = 600 TabIndex = 6 Top = 360 Width = 330 End End Begin VB.Frame ChannelFrame Caption = "Output" Height = 3495 Left = 120 TabIndex = 3 Top = 2160 Width = 5775 Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 0 Left = 4410 TabIndex = 35 Top = 600 Width = 1155 End Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 7 Left = 4410 TabIndex = 34 Top = 3120 Width = 1155 End Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 6 Left = 4410 TabIndex = 33 Top = 2760 Width = 1155 End Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 1 Left = 4410 TabIndex = 32 Top = 960 Width = 1155 End Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 2 Left = 4410 TabIndex = 31 Top = 1320 Width = 1155 End Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 3 Left = 4410 TabIndex = 30 Top = 1680 Width = 1155 End Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 4 Left = 4410 TabIndex = 29 Top = 2040 Width = 1155 End Begin VB.Label VoltsLabel Alignment = 2 'Center Height = 240 Index = 5 Left = 4410 TabIndex = 28 Top = 2400 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 0 Left = 2280 TabIndex = 27 Top = 600 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 7 Left = 2310 TabIndex = 26 Top = 3120 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 6 Left = 2310 TabIndex = 25 Top = 2760 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 1 Left = 2310 TabIndex = 24 Top = 960 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 2 Left = 2310 TabIndex = 23 Top = 1320 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 3 Left = 2310 TabIndex = 22 Top = 1680 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 4 Left = 2310 TabIndex = 21 Top = 2040 Width = 1155 End Begin VB.Label CountsLabel Alignment = 2 'Center Height = 240 Index = 5 Left = 2310 TabIndex = 20 Top = 2400 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 0" Height = 240 Index = 0 Left = 210 TabIndex = 19 Top = 600 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 7" Height = 240 Index = 7 Left = 210 TabIndex = 18 Top = 3120 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 6" Height = 240 Index = 6 Left = 210 TabIndex = 17 Top = 2760 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 1" Height = 240 Index = 1 Left = 210 TabIndex = 16 Top = 960 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 2" Height = 240 Index = 2 Left = 210 TabIndex = 15 Top = 1320 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 3" Height = 240 Index = 3 Left = 210 TabIndex = 14 Top = 1680 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 4" Height = 240 Index = 4 Left = 210 TabIndex = 13 Top = 2040 Width = 1155 End Begin VB.Label ChannelLabel Alignment = 2 'Center Caption = "Channel 5" Height = 240 Index = 5 Left = 210 TabIndex = 12 Top = 2400 Width = 1155 End Begin VB.Label VLabel Alignment = 2 'Center Caption = "Volts" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 4410 TabIndex = 11 Top = 240 Width = 1155 End Begin VB.Label CLabel Alignment = 2 'Center Caption = "Counts" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 2310 TabIndex = 10 Top = 240 Width = 1155 End Begin VB.Label ChanLabel Alignment = 2 'Center Caption = "Channel" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 210 TabIndex = 9 Top = 270 Width = 1155 End End Begin ComctlLib.StatusBar ErrorStatus Align = 2 'Align Bottom Height = 285 Left = 0 TabIndex = 2 Top = 6600 Width = 6030 _ExtentX = 10636 _ExtentY = 503 Style = 1 SimpleText = "" _Version = 327682 BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} NumPanels = 1 BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} Key = "" Object.Tag = "" EndProperty EndProperty End Begin VB.TextBox InstructText BackColor = &H8000000F& Height = 1575 Left = 120 Locked = -1 'True MultiLine = -1 'True TabIndex = 1 Text = "Sample0Unit.frx":0000 Top = 480 Width = 5775 End Begin VB.Timer TestTimer Enabled = 0 'False Interval = 100 Left = 5160 Top = 120 End Begin VB.Label NameLabel Alignment = 2 'Center AutoSize = -1 'True Caption = "104-AIO12-8" BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 2280 TabIndex = 0 Top = 120 Width = 1575 End End Attribute VB_Name = "Sample0Form" 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 = True) Then TestTimer.Enabled = False ErrorStatus.SimpleText = "" TestButton.Caption = "Start Test" BaseEdit.Enabled = True Else Address = "&H" + BaseEdit.Text TestButton.Caption = "Abort Test" BaseEdit.Enabled = False TestTimer.Enabled = True End If ' end else End Sub Private Function CheckForEOC(Address As Integer) As Boolean EOCCheck = InPortB(Address) CheckForEOC = ((EOCCheck And &H80) = &H80) End Function Private Sub TestTimer_Timer() For chan = 0 To 7 timeout = 65535 Call OutPortB(Address + 2, chan Or 8) ' write channel Do While (Not (CheckForEOC(Address)) And (timeout > 0)) timeout = timeout - 1 Loop If (timeout = 0) Then ErrorStatus.SimpleText = "A/D timeout on Channel " + chan CountsLabel(chan).Caption = "A/D Timeout" VoltsLabel(chan).Caption = "A/D Timeout" Else counts = InPort(Address + 2) volts = ((counts Xor 2048#) - 2048) * 0.00244 CountsLabel(chan).Caption = counts VoltsLabel(chan).Caption = volts End If ' end else Next ' end for chan End Sub