frmmain.frm

来自「16 relay output channels and 16 isolated」· FRM 代码 · 共 987 行 · 第 1/3 页

FRM
987
字号
         Begin VB.Label Label4 
            Alignment       =   2  'Center
            BorderStyle     =   1  'Fixed Single
            Caption         =   "&5"
            Height          =   255
            Index           =   5
            Left            =   2160
            TabIndex        =   32
            Top             =   240
            Width           =   615
         End
         Begin VB.Label Label4 
            Alignment       =   2  'Center
            BorderStyle     =   1  'Fixed Single
            Caption         =   "&4"
            Height          =   255
            Index           =   4
            Left            =   2760
            TabIndex        =   30
            Top             =   240
            Width           =   615
         End
         Begin VB.Label Label4 
            Alignment       =   2  'Center
            BorderStyle     =   1  'Fixed Single
            Caption         =   "&3"
            Height          =   255
            Index           =   3
            Left            =   3360
            TabIndex        =   28
            Top             =   240
            Width           =   615
         End
         Begin VB.Label Label4 
            Alignment       =   2  'Center
            BorderStyle     =   1  'Fixed Single
            Caption         =   "&2"
            Height          =   255
            Index           =   2
            Left            =   3960
            TabIndex        =   26
            Top             =   240
            Width           =   615
         End
         Begin VB.Label Label4 
            Alignment       =   2  'Center
            BorderStyle     =   1  'Fixed Single
            Caption         =   "&1"
            Height          =   255
            Index           =   1
            Left            =   4560
            TabIndex        =   24
            Top             =   240
            Width           =   615
         End
         Begin VB.Label Label4 
            Alignment       =   2  'Center
            BorderStyle     =   1  'Fixed Single
            Caption         =   "&0"
            Height          =   255
            Index           =   0
            Left            =   5160
            TabIndex        =   22
            Top             =   240
            Width           =   615
         End
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 7 interrupt:"
         Height          =   255
         Index           =   7
         Left            =   3360
         TabIndex        =   11
         Top             =   2520
         Width           =   1335
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 6 interrupt:"
         Height          =   255
         Index           =   6
         Left            =   3360
         TabIndex        =   10
         Top             =   2160
         Width           =   1335
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 5 interrupt:"
         Height          =   255
         Index           =   5
         Left            =   3360
         TabIndex        =   9
         Top             =   1800
         Width           =   1335
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 4 interrupt:"
         Height          =   255
         Index           =   4
         Left            =   3360
         TabIndex        =   8
         Top             =   1440
         Width           =   1335
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 3 interrupt:"
         Height          =   255
         Index           =   3
         Left            =   240
         TabIndex        =   7
         Top             =   2520
         Width           =   1335
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 2 interrupt:"
         Height          =   255
         Index           =   2
         Left            =   240
         TabIndex        =   6
         Top             =   2160
         Width           =   1335
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 1 interrupt:"
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   5
         Top             =   1800
         Width           =   1335
      End
      Begin VB.CheckBox chkDiInterrupt 
         Caption         =   "DI 0 interrupt:"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   4
         Top             =   1440
         Width           =   1335
      End
   End
   Begin VB.CheckBox chkStatusChange 
      Caption         =   "Status Change Interrupt:"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   1440
      Width           =   2175
   End
   Begin VB.CheckBox chkFDiPatternMatch 
      Caption         =   "Pattern Match Interrupt:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   720
      Width           =   2055
   End
   Begin VB.CheckBox chkTimer 
      Caption         =   "Timer interrupt:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   1080
      Width           =   1815
   End
   Begin VB.Label Label3 
      Caption         =   "Change Status channel(0-31):"
      Height          =   255
      Left            =   3600
      TabIndex        =   19
      Top             =   1440
      Width           =   2175
   End
   Begin VB.Label Label2 
      Caption         =   "Pattern Match value:"
      Height          =   255
      Left            =   3600
      TabIndex        =   17
      Top             =   720
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "Counter 2 value(2~65535):"
      Height          =   255
      Left            =   3600
      TabIndex        =   15
      Top             =   1080
      Width           =   2055
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub EnableControls(bEnabled As Boolean)
Dim i As Integer
  
  'Timer interrupt event controls enable or disable
  chkTimer.Enabled = bEnabled
  txtCounterEvent.Enabled = bEnabled
  txtCounterValue.Enabled = bEnabled
  
  'Pattern match interrupt event controls enable or disable
  chkFDiPatternMatch.Enabled = bEnabled
  txtPatternMatchEvent.Enabled = bEnabled
  txtPatternMatchValue.Enabled = bEnabled
  
  'Status change interrupt event controls enable or disable
  chkStatusChange.Enabled = bEnabled
  txtStatusChangeEvent.Enabled = bEnabled
  txtChangeStatusChannel.Enabled = bEnabled
  
  'Auxiliary DI interrupt event controls enable or disable
  For i = 0 To 7
    lstDiSignalCondition(i).Enabled = bEnabled
    chkDiInterrupt(i).Enabled = bEnabled
    txtDiInterrupt(i).Enabled = bEnabled
  Next i
  
  'Execution controls enable and disable
  cmdStart.Enabled = bEnabled
  cmdStop.Enabled = False
End Sub

Private Sub CloseCreatedEvents()
Dim i As Integer

  ' Clear all checked event.
  ' It's better to contain the same event open/close count. The driver
  ' cannot not know which program open and close event, just keep the
  ' open counts for handling the event exporting.
  '
  If chkTimer.value = 1 Then chkTimer.value = 0
  If chkFDiPatternMatch.value = 1 Then chkFDiPatternMatch.value = 0
  If chkStatusChange.value = 1 Then chkStatusChange.value = 0
  
  For i = 0 To 7
    If (chkDiInterrupt(i).value = 1) Then chkDiInterrupt(i).value = 0
  Next i
  
  
End Sub

Private Sub chkDiInterrupt_Click(Index As Integer)
Dim bEnabled As Boolean
  '
  ' Enable/disable driver to export DI interrupt
  '
  If (chkDiInterrupt(Index).value = 1) Then
    bEnabled = True
  Else
    bEnabled = False
  End If
  
  Select Case Index
  Case 0
    DaqDevice.EventEnable deDiInterruptOfChannel0, bEnabled 'Enable DI 0 interrupt event
  Case 1
    DaqDevice.EventEnable deDiInterruptOfChannel1, bEnabled 'Enable DI 1 interrupt event
  Case 2
    DaqDevice.EventEnable deDiInterruptOfChannel2, bEnabled 'Enable DI 2 interrupt event
  Case 3
    DaqDevice.EventEnable deDiInterruptOfChannel3, bEnabled 'Enable DI 3 interrupt event
  Case 4
    DaqDevice.EventEnable deDiInterruptOfChannel4, bEnabled 'Enable DI 4 interrupt event
  Case 5
    DaqDevice.EventEnable deDiInterruptOfChannel5, bEnabled 'Enable DI 5 interrupt event
  Case 6
    DaqDevice.EventEnable deDiInterruptOfChannel6, bEnabled 'Enable DI 6 interrupt event
  Case 7
    DaqDevice.EventEnable deDiInterruptOfChannel7, bEnabled 'Enable DI 7 interrupt event
  End Select
  

End Sub

Private Sub chkFDiPatternMatch_Click()

  '
  ' Enable/disable driver to export Fast DI pattern match events.
  ' This event generated after FDI function start up.
  '
  If (chkFDiPatternMatch.value = 1) Then
    DaqDevice.EventEnable deDiPatternMatch, True        'Enable Pattern match event
    txtPatternMatchValue.Enabled = False
  Else
    DaqDevice.EventEnable deDiPatternMatch, False       'Disable Pattern Match event
    txtPatternMatchValue.Enabled = True
  End If

End Sub

Private Sub chkStatusChange_Click()

  '
  ' Enable/Disabe driver to export Fast DI status change events
  ' This event generated after Fast DI function start up.
  '
  If chkStatusChange.value = 1 Then
    DaqDevice.EventEnable deDiStatusChange, True        'Enable Status change event
    txtChangeStatusChannel.Enabled = False
  Else
    DaqDevice.EventEnable deDiStatusChange, False       'Disable Status change event
    txtChangeStatusChannel.Enabled = True
  End If

End Sub

Private Sub chkTimer_Click()

  '
  ' Enable/Disable driver to export Timer interrupt event
  '
  If chkTimer.value = 1 Then
    DaqDevice.EventEnable deTcTimer, True, 1
    txtCounterValue.Enabled = False
  Else
    DaqDevice.EventEnable deTcTimer, False
    txtCounterValue.Enabled = True
  End If

End Sub

Private Sub cmdExit_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?