📄 frmmain.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Advantech Driver Demo: Digital Input with Interrupt Event for PCI-1730"
ClientHeight = 4890
ClientLeft = 3600
ClientTop = 2820
ClientWidth = 7995
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4890
ScaleWidth = 7995
ShowInTaskbar = 0 'False
Begin VB.CommandButton btnClose
Caption = "&Close"
Height = 375
Left = 6600
TabIndex = 43
Top = 4200
Width = 1215
End
Begin VB.Timer Timer1
Left = 5040
Top = 4080
End
Begin VB.Frame Frame4
Caption = "Interrupt Event"
Height = 2535
Left = 2880
TabIndex = 14
Top = 1200
Width = 4935
Begin VB.CommandButton btnDisable4
Caption = "&Disable"
Enabled = 0 'False
Height = 255
Left = 3960
TabIndex = 37
Top = 1800
Width = 855
End
Begin VB.CommandButton btnDisable3
Caption = "&Disable"
Enabled = 0 'False
Height = 255
Left = 3960
TabIndex = 36
Top = 1440
Width = 855
End
Begin VB.CommandButton btnDisable2
Caption = "&Disable"
Enabled = 0 'False
Height = 255
Left = 3960
TabIndex = 35
Top = 1080
Width = 855
End
Begin VB.CommandButton btnDisable1
Caption = "&Disable"
Enabled = 0 'False
Height = 255
Left = 3960
TabIndex = 34
Top = 720
Width = 855
End
Begin VB.CommandButton btnEnable4
Caption = "&Enable"
Height = 255
Left = 3000
TabIndex = 33
Top = 1800
Width = 855
End
Begin VB.CommandButton btnEnable3
Caption = "&Enable"
Height = 255
Left = 3000
TabIndex = 32
Top = 1440
Width = 855
End
Begin VB.CommandButton btnEnable2
Caption = "&Enable"
Height = 255
Left = 3000
TabIndex = 31
Top = 1080
Width = 855
End
Begin VB.CommandButton btnEnable1
Caption = "&Enable"
Height = 255
Left = 3000
TabIndex = 30
Top = 720
Width = 855
End
Begin VB.TextBox editIntCount_DI1
Enabled = 0 'False
Height = 285
Left = 1800
TabIndex = 29
Top = 1800
Width = 975
End
Begin VB.TextBox editIntCount_DI0
Enabled = 0 'False
Height = 285
Left = 1800
TabIndex = 28
Top = 1440
Width = 975
End
Begin VB.TextBox editIntCount_IDI1
Enabled = 0 'False
Height = 285
Left = 1800
TabIndex = 27
Top = 1080
Width = 975
End
Begin VB.TextBox editIntCount_IDI0
Enabled = 0 'False
Height = 285
Left = 1800
TabIndex = 26
Top = 720
Width = 975
End
Begin VB.TextBox editCount_IDI1
Height = 285
Left = 600
TabIndex = 25
Top = 1080
Width = 975
End
Begin VB.TextBox editCount_DI0
Height = 285
Left = 600
TabIndex = 24
Top = 1440
Width = 975
End
Begin VB.TextBox editCount_DI1
Height = 285
Left = 600
TabIndex = 23
Top = 1800
Width = 975
End
Begin VB.TextBox editCount_IDI0
Height = 285
Left = 600
TabIndex = 22
Top = 720
Width = 975
End
Begin VB.Label Label11
BorderStyle = 1 'Fixed Single
Caption = "WARNING : DI Interrupt Occured Frequency range : 0 ~ 30KHz"
Height = 255
Left = 120
TabIndex = 38
Top = 2160
Width = 4695
End
Begin VB.Label Label10
Caption = "DI1"
Height = 255
Left = 120
TabIndex = 21
Top = 1800
Width = 375
End
Begin VB.Label Label9
Caption = "DI0"
Height = 255
Left = 120
TabIndex = 20
Top = 1440
Width = 375
End
Begin VB.Label Label8
Caption = "IDI1"
Height = 255
Left = 120
TabIndex = 19
Top = 1080
Width = 375
End
Begin VB.Label Label7
Caption = "IDI0"
Height = 255
Left = 120
TabIndex = 18
Top = 720
Width = 375
End
Begin VB.Label Label6
Caption = "Events / S "
Height = 255
Left = 1920
TabIndex = 17
Top = 360
Width = 855
End
Begin VB.Label Label5
Caption = "Event_Cnt"
Height = 255
Left = 600
TabIndex = 16
Top = 360
Width = 855
End
Begin VB.Label Label4
Caption = "No."
Height = 255
Left = 120
TabIndex = 15
Top = 360
Width = 375
End
End
Begin VB.Frame Frame3
Caption = "Digital Input Scan"
Height = 2535
Left = 120
TabIndex = 6
Top = 1200
Width = 2655
Begin VB.CommandButton btnStop
Caption = "St&op"
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 13
Top = 1680
Width = 975
End
Begin VB.CommandButton btnStart
Caption = "&Start"
Height = 375
Left = 120
TabIndex = 12
Top = 1680
Width = 975
End
Begin VB.TextBox editScanData
Enabled = 0 'False
Height = 375
Left = 1080
TabIndex = 11
Top = 960
Width = 975
End
Begin VB.TextBox editScanTime
Height = 375
Left = 1080
TabIndex = 8
Top = 360
Width = 975
End
Begin VB.Label Label3
Caption = "Data :"
Height = 255
Left = 480
TabIndex = 10
Top = 960
Width = 615
End
Begin VB.Label Label2
Caption = "mS"
Height = 255
Left = 2160
TabIndex = 9
Top = 480
Width = 375
End
Begin VB.Label Label1
Caption = "Scan Time : "
Height = 255
Left = 120
TabIndex = 7
Top = 480
Width = 975
End
End
Begin VB.Frame Frame2
Caption = "Port"
Height = 975
Left = 6240
TabIndex = 3
Top = 120
Width = 1575
Begin VB.VScrollBar scrollChanSpin
Height = 375
Left = 1200
Max = 17
TabIndex = 5
Top = 360
Width = 255
End
Begin VB.TextBox editChan
Height = 375
Left = 120
TabIndex = 4
Top = 360
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "Device Selection"
Height = 975
Left = 120
TabIndex = 0
Top = 120
Width = 6015
Begin VB.CommandButton btnSelDev
Caption = "Select &Device"
Height = 375
Left = 4560
TabIndex = 2
Top = 360
Width = 1335
End
Begin VB.TextBox editDevName
Enabled = 0 'False
Height = 375
Left = 120
TabIndex = 1
Top = 360
Width = 4335
End
End
Begin VB.Label Label15
Caption = "Interrupt Occured in Hardware = Event_Cnt * ( Events / S )"
Height = 255
Left = 480
TabIndex = 42
Top = 4560
Width = 4335
End
Begin VB.Label Label14
Caption = "Event_Cnt => 1 ~ 10000"
Height = 255
Left = 480
TabIndex = 41
Top = 4320
Width = 1815
End
Begin VB.Label Label13
Caption = "Events / S => Interrupt Event count per Second"
Height = 255
Left = 480
TabIndex = 40
Top = 4080
Width = 3615
End
Begin VB.Label Label12
Caption = "Hint : This example for PCI-1730 only."
Height = 255
Left = 120
TabIndex = 39
Top = 3840
Width = 2775
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btnClose_Click()
Dim ExitCode As Long
m_bContinue = False
If (ThreadHandle <> 0) Then
GetExitCodeThread ThreadHandle, ExitCode
If (ExitCode = STILL_ACTIVE) Then
TerminateThread ThreadHandle, ExitCode
End If
End If
If (m_DriverHandle <> 0) Then
Dim EventSetting As PT_EnableEvent
EventSetting.EventType = ADS_EVT_INTERRUPT_IDI0
EventSetting.Enabled = 0
m_ErrCde = DRV_EnableEvent(m_DriverHandle, EventSetting)
EventSetting.EventType = ADS_EVT_INTERRUPT_IDI1
EventSetting.Enabled = 0
m_ErrCde = DRV_EnableEvent(m_DriverHandle, EventSetting)
EventSetting.EventType = ADS_EVT_INTERRUPT_DI0
EventSetting.Enabled = 0
m_ErrCde = DRV_EnableEvent(m_DriverHandle, EventSetting)
EventSetting.EventType = ADS_EVT_INTERRUPT_DI1
EventSetting.Enabled = 0
m_ErrCde = DRV_EnableEvent(m_DriverHandle, EventSetting)
DRV_DeviceClose (m_DriverHandle)
End If
Unload Me
End Sub
Private Sub btnDisable1_Click()
Dim EventSetting As PT_EnableEvent
Dim flag As Boolean
flag = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -