mainform.frm
来自「16 relay output channels and 16 isolated」· FRM 代码 · 共 596 行 · 第 1/2 页
FRM
596 行
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form MainForm
Caption = "Digital input with Interrupt for PCI-1758"
ClientHeight = 6030
ClientLeft = 60
ClientTop = 345
ClientWidth = 7470
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6030
ScaleWidth = 7470
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdExit
Caption = "Exit"
Height = 495
Left = 5760
TabIndex = 17
Top = 480
Width = 1455
End
Begin VB.Frame Frame4
Caption = "Scan Digital Input"
Height = 2295
Left = 5280
TabIndex = 6
Top = 3600
Width = 2055
Begin VB.Timer ScanTimer
Enabled = 0 'False
Interval = 200
Left = 1680
Top = 720
End
Begin VB.CommandButton cmdStop
Caption = "Stop"
Height = 375
Left = 1200
TabIndex = 13
Top = 1440
Width = 735
End
Begin VB.CommandButton cmdStart
Caption = "Start"
Height = 375
Left = 120
TabIndex = 12
Top = 1440
Width = 855
End
Begin VB.ComboBox cmbPort
Height = 315
Left = 360
Style = 2 'Dropdown List
TabIndex = 10
Top = 360
Width = 1335
End
Begin VB.Label Label6
Caption = "Hex"
Height = 255
Left = 1200
TabIndex = 23
Top = 960
Width = 375
End
Begin VB.Label txtPortValue
BorderStyle = 1 'Fixed Single
Height = 375
Left = 360
TabIndex = 11
Top = 840
Width = 615
End
End
Begin VB.Frame Filter
Caption = "Filter"
Height = 2055
Left = 5280
TabIndex = 5
Top = 1440
Width = 2055
Begin VB.CommandButton cmdEnableFilter
Caption = "Enable..."
Height = 375
Left = 720
TabIndex = 9
Top = 1560
Width = 1095
End
Begin VB.TextBox txtFilterCounter
Height = 285
Left = 240
TabIndex = 7
Text = "20000"
Top = 720
Width = 1095
End
Begin VB.Label Label5
Caption = "kHz"
Height = 255
Left = 1440
TabIndex = 22
Top = 1080
Width = 375
End
Begin VB.Label Label3
Caption = "="
Height = 255
Left = 240
TabIndex = 21
Top = 1080
Width = 255
End
Begin VB.Label Label1
Caption = "*0.2us"
Height = 255
Left = 1320
TabIndex = 20
Top = 720
Width = 615
End
Begin VB.Label txtFilterFreq
Caption = "Label5"
Height = 255
Left = 600
TabIndex = 19
Top = 1080
Width = 735
End
Begin VB.Label Label2
Caption = "Filter Counter"
Height = 255
Left = 120
TabIndex = 8
Top = 480
Width = 1215
End
End
Begin VB.Frame Frame2
Caption = "Interrupt"
Height = 4455
Left = 120
TabIndex = 3
Top = 1440
Width = 5055
Begin VB.Timer IntTimer
Enabled = 0 'False
Interval = 1001
Left = 3240
Top = 3960
End
Begin VB.CommandButton cmdStopAll
Caption = "Stop All"
Height = 375
Left = 3840
TabIndex = 16
Top = 3960
Width = 975
End
Begin VB.CommandButton cmdRising
Caption = "Rising Trigger"
Height = 375
Left = 1800
TabIndex = 15
Top = 3960
Width = 1215
End
Begin VB.CommandButton cmdFalling
Caption = "Falling Trigger"
Height = 375
Left = 360
TabIndex = 14
Top = 3960
Width = 1215
End
Begin MSComctlLib.ListView InterruptList
Height = 3495
Left = 120
TabIndex = 4
Top = 360
Width = 4815
_ExtentX = 8493
_ExtentY = 6165
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
Checkboxes = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Interrupt Channel"
Object.Width = 2117
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 1
Text = "Trigger Mode"
Object.Width = 2646
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "Filter"
Object.Width = 1111
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "Event Count"
Object.Width = 2117
EndProperty
End
End
Begin VB.Frame Frame1
Caption = "Select Device"
Height = 1215
Left = 120
TabIndex = 0
Top = 120
Width = 5295
Begin VB.CommandButton cmdSelect
Caption = "Select Device"
Height = 375
Left = 3720
TabIndex = 2
Top = 240
Width = 1455
End
Begin VB.Label Label4
Caption = "Device Name"
Height = 255
Left = 240
TabIndex = 18
Top = 360
Width = 1335
End
Begin VB.Label txtDeviceName
BorderStyle = 1 'Fixed Single
Height = 375
Left = 240
TabIndex = 1
Top = 720
Width = 4935
End
End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim DIRisingTrigger(0 To 3) As Long
Dim DIFallingTrigger(0 To 3) As Long
Dim DIFilterEnable(0 To 3) As Long
Dim DIInterruptEnable(0 To 15) As Long
Dim dwStartTime, dwCurrentTime, dwTime As Long
Dim dwEventCount(0 To 128) As Long
Dim ulDataLength As Long
Dim m_FilterCounter As Long
Dim m_bThreadFlag As Boolean
Dim i As Integer
Dim ExitCode As Long
Dim m_ulDevNum As Long
Dim m_ErrCde As Long
Dim m_szErrMsg As String
Dim ThreadID As Long
Private Sub SetListTrigger()
Dim lstItem As ListItem
Dim strTemp As String
Dim lTemp As Long
For i = 0 To m_DIChanNum - 1
Set lstItem = InterruptList.ListItems(i + 1)
If (i Mod 32) = 31 Then
lTemp = -(2 ^ 31)
Else
lTemp = 2 ^ (i Mod 32)
End If
If ((DIRisingTrigger(i \ 32) And lTemp) And (DIFallingTrigger(i \ 32) And lTemp)) Then
strTemp = "Rising & Falling Trigger"
Else
If (DIFallingTrigger(i \ 32) And lTemp) Then
strTemp = "Falling Trigger"
Else
If (DIRisingTrigger(i \ 32) And lTemp) Then
strTemp = "Rising Trigger"
Else
strTemp = "None"
End If
End If
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?