⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmrun.frm

📁 16 relay output channels and 16 isolated digital input channels LED indicators to show activated
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmRun 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Temperature Mesurement Demo"
   ClientHeight    =   2400
   ClientLeft      =   4830
   ClientTop       =   2130
   ClientWidth     =   4755
   BeginProperty Font 
      Name            =   "MS Sans Serif"
      Size            =   8.25
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000008&
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2400
   ScaleWidth      =   4755
   Begin VB.TextBox txtTemperature 
      Appearance      =   0  'Flat
      BorderStyle     =   0  'None
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   2280
      TabIndex        =   8
      Text            =   "0.000"
      Top             =   480
      Width           =   2055
   End
   Begin VB.ListBox lstTemperatureUnit 
      Appearance      =   0  'Flat
      Height          =   810
      Left            =   240
      TabIndex        =   6
      Top             =   360
      Width           =   1695
   End
   Begin VB.HScrollBar hscrlFreq 
      Height          =   375
      LargeChange     =   10
      Left            =   2160
      Max             =   100
      TabIndex        =   3
      Top             =   960
      Value           =   10
      Width           =   2295
   End
   Begin VB.Timer tmrRead 
      Left            =   120
      Top             =   1200
   End
   Begin VB.CommandButton cmdRead 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "&Read one data"
      Height          =   495
      Left            =   2640
      TabIndex        =   2
      Top             =   1680
      Width           =   1455
   End
   Begin VB.CommandButton cmdExit 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "E&xit"
      Height          =   495
      Left            =   480
      TabIndex        =   0
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Shape shapSquare 
      Height          =   615
      Left            =   2160
      Top             =   360
      Width           =   2295
   End
   Begin VB.Label labLabelTemp 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Temperature read"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2160
      TabIndex        =   1
      Top             =   120
      Width           =   1575
   End
   Begin VB.Label labTemperatureUnit 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Temperature unit"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   240
      TabIndex        =   7
      Top             =   120
      Width           =   1575
   End
   Begin VB.Label labFreqHigh 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "10 (time/s)"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   3720
      TabIndex        =   5
      Top             =   1320
      Width           =   975
   End
   Begin VB.Label labFrequencyLow 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "0 (Stop)"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2280
      TabIndex        =   4
      Top             =   1320
      Width           =   855
   End
End
Attribute VB_Name = "frmRun"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdExit_Click()
    frmRun.Hide
    frmDevSel.Show
    frmDevSel.cmdExit.SetFocus
End Sub

Private Sub cmdRead_Click()
    Dim fTemp As Single
    
    tmrRead.Enabled = False
    ptTCMuxRead.TempScale = lstTemperatureUnit.ListIndex
    ptTCMuxRead.temp = DRV_GetAddress(fTemp)
    
    ErrCde = DRV_TCMuxRead(DeviceHandle, ptTCMuxRead)
   ' If (ErrCde <> 0) Then
   '      DRV_GetErrorMessage ErrCde, szErrMsg
   '     Response = MsgBox(szErrMsg, vbOKOnly, "Error!!")
   '     Exit Sub
   '  End If
    UpDateValue (fTemp)
End Sub

Private Sub Form_Load()

    '''''''''''
    ' 1. Set default temperature unit
    '''''''''''
    ' Add selectable items for temperature unit
    lstTemperatureUnit.AddItem "Celsius"
    lstTemperatureUnit.AddItem "Fahrenheit"
    lstTemperatureUnit.AddItem "Rankine"
    lstTemperatureUnit.AddItem "Kelvin"

    ' Set the default selection of temperature unit
    lstTemperatureUnit.ListIndex = 0
    
    hscrlFreq_Change
End Sub

Private Sub Form_Unload(Cancel As Integer)
    tmrRead.Enabled = False
    frmDevSel.Show
End Sub

Private Sub hscrlFreq_Change()
    If hscrlFreq.value = 0 Then
        tmrRead.Interval = 0
    Else
        tmrRead.Interval = 10000 / hscrlFreq.value
    End If
    tmrRead.Enabled = True
End Sub

Private Sub tmrRead_Timer()
    Dim fTemp As Single
    ptTCMuxRead.TempScale = lstTemperatureUnit.ListIndex
    ptTCMuxRead.temp = DRV_GetAddress(fTemp)
    
    ErrCde = DRV_TCMuxRead(DeviceHandle, ptTCMuxRead)
'    If (ErrCde <> 0) Then
'        DRV_GetErrorMessage ErrCde, szErrMsg
'        Response = MsgBox(szErrMsg, vbOKOnly, "Error!!")
'        tmrRead.Enabled = False
'        Exit Sub
'    End If
    UpDateValue (fTemp)
End Sub

Private Sub UpDateValue(fValue As Single)
    Dim tempStr As String

    Select Case ptTCMuxRead.TempScale
    Case 0
        tempStr = "*C"
    Case 1
        tempStr = "*F"
    Case 2
        tempStr = "*R"
    Case 3
        tempStr = "*K"
    End Select
    txtTemperature.Text = Left(Str(fValue), 8) + tempStr
End Sub

⌨️ 快捷键说明

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