VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 1935 ClientLeft = 60 ClientTop = 450 ClientWidth = 6720 LinkTopic = "Form1" ScaleHeight = 1935 ScaleWidth = 6720 StartUpPosition = 3 'Windows Default Begin VB.Timer ReadTime Enabled = 0 'False Interval = 1 Left = 360 Top = 120 End Begin VB.CheckBox OutCheck Caption = "Output" Height = 255 Index = 1 Left = 4200 TabIndex = 1 Top = 1320 Width = 1575 End Begin VB.CheckBox OutCheck Caption = "Output" Height = 195 Index = 0 Left = 960 TabIndex = 0 Top = 1320 Width = 1455 End Begin VB.Image LevelImage Height = 375 Index = 15 Left = 3600 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 14 Left = 3960 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 13 Left = 4320 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 12 Left = 4680 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 11 Left = 5040 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 10 Left = 5400 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 9 Left = 5760 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 8 Left = 6120 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 7 Left = 240 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 6 Left = 600 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 5 Left = 960 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 4 Left = 1320 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 3 Left = 1680 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 2 Left = 2040 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 1 Left = 2400 Top = 720 Width = 375 End Begin VB.Image LevelImage Height = 375 Index = 0 Left = 2760 Top = 720 Width = 375 End Begin VB.Image LowImage Height = 375 Left = 1320 Picture = "Form1.frx":0000 Stretch = -1 'True Top = 120 Visible = 0 'False Width = 375 End Begin VB.Image HighImage Height = 375 Left = 840 Picture = "Form1.frx":0702 Stretch = -1 'True Top = 120 Visible = 0 'False Width = 375 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Public DeviceIndex As Long Dim DIOData As Long Dim DoUpdate As Boolean Public DetectOK As Boolean Private Sub Form_Load() Dim box As DetectForm Dim OutMask As Byte Dim I As Integer Dim Status As Long DeviceIndex = diOnly OutMask = 0 DIOData = &HFFFF Status = DIO_Configure(DeviceIndex, False, OutMask, DIOData) If Status <> 0 Then Call DetectForm.Show(vbModal, Me) If DetectOK = False Then Unload Me Exit Sub End If DIO_Configure DeviceIndex, False, OutMask, DIOData End If For I = 0 To 2 CTR_8254Mode DeviceIndex, I, 1, 2 CTR_8254Mode DeviceIndex, I, 2, 3 Next I DoUpdate = True ReadTime.Enabled = True End Sub Private Sub LevelImage_Click(Index As Integer) Dim NewValue As Boolean DIOData = DIOData Xor (ShiftLeft(1, Index)) NewValue = (DIOData And (ShiftLeft(1, Index))) <> 0 DIO_Write1 DeviceIndex, Index, NewValue DoUpdate = True End Sub Private Sub OutCheck_Click(Index As Integer) Dim OutMask As Byte Dim I As Integer OutMask = 0 For I = 0 To 1 If OutCheck(I).Value = Checked Then OutMask = OutMask Or ShiftLeft(1, I) End If Next I DIOData = DIOData Or ShiftLeft(&HFF, (Index * 8)) DIO_Configure DeviceIndex, False, OutMask, DIOData DoUpdate = True End Sub Private Sub ReadTime_Timer() Dim I As Integer Dim oDIOData As Long Dim Changes As Long oDIOData = DIOData DIO_ReadAll DeviceIndex, DIOData Changes = DIOData Xor oDIOData If DoUpdate = True Then Changes = &HFFFF DoUpdate = False End If For I = 0 To 15 If (Changes And ShiftLeft(1, I)) <> 0 Then If (DIOData And ShiftLeft(1, I)) <> 0 Then LevelImage(I).Picture = HighImage.Picture Else LevelImage(I).Picture = LowImage.Picture End If End If Next I End Sub