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

📄 frmmeas.frm

📁 Tektronix TDS3000&TDS3000B series oscilloscope program examples ver3.0
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Measure"
   ClientHeight    =   2040
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4125
   LinkTopic       =   "Form1"
   ScaleHeight     =   2040
   ScaleWidth      =   4125
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton DoneButton 
      Caption         =   "Done"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   492
      Left            =   2160
      TabIndex        =   4
      Top             =   1200
      Width           =   1332
   End
   Begin VB.CommandButton StartButton 
      Caption         =   "Start"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   492
      Left            =   480
      TabIndex        =   3
      Top             =   1200
      Width           =   1332
   End
   Begin VB.Frame Frame1 
      Caption         =   "Comm Port Selection"
      Height          =   732
      Left            =   600
      TabIndex        =   0
      Top             =   240
      Width           =   2652
      Begin VB.OptionButton CommPort 
         Caption         =   "COM2"
         Height          =   372
         Index           =   1
         Left            =   1560
         TabIndex        =   2
         Top             =   240
         Width           =   972
      End
      Begin VB.OptionButton CommPort 
         Caption         =   "COM1"
         Height          =   372
         Index           =   0
         Left            =   240
         TabIndex        =   1
         Top             =   240
         Width           =   1092
      End
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   0
      Top             =   840
      _ExtentX        =   794
      _ExtentY        =   794
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Left            =   120
      Top             =   120
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SelectedCommPort As Integer

'
' The user selected a serial port, we'll keep track of it
' and use it when we open serial communications.
'
Private Sub CommPort_Click(Index As Integer)
    If Index = 0 Then
        SelectedCommPort = 1
    Else
        SelectedCommPort = 2
    End If
End Sub

'
' The user is finished, so exit the program.
'
Private Sub DoneButton_Click()
    End
End Sub

'
' Perform one time initialization, including:
'   setting the default serial port to COMM2
'   setting the COMM2 radio button.
'   making sure the time is off
'
Private Sub Form_Load()
    ' Set the default comm port to COMM2
    SelectedCommPort = 2
    CommPort(1).Value = True
    Timer1.Enabled = False
End Sub


Private Sub StartButton_Click()
'
'  meas.bas - program to measure a parameter of an oscilloscope waveform
'
'

' Turn off the start button until we are done.
StartButton.Enabled = False

'
' Open the selected comm port and set it to generate a read event on ever
'   character read.
    MSComm1.CommPort = SelectedCommPort
    MSComm1.PortOpen = True
    MSComm1.RThreshold = 1


'  Clear any existing menus, run the factory initialization, then lock out
'  the front panel so there are no changes made to settings.
'
    Call RS232WRITE(MSComm1, "CLEARMENU")
    Call RS232WRITE(MSComm1, "FACTORY")
    Call RS232WRITE(MSComm1, "LOCK ALL")

'
' Print a message on the screen instructing the user to connect
' Channel 1 to the front-panel PROBE COMPENSATION SIGNAL.
'
    
    msg = " Connect the PROBE COMPENSATION SIGNAL to channel 1" ' Define message.
    Style = vbOKOnly + vbInformation                            ' Define buttons.
    Title = "Probe Connection"                                  ' Define title.
    response = MsgBox(msg, Style, Title)
'
'  Wait for the scope to finish the factory command.
'
    Call RS232WAITCOM(MSComm1, 12)
'
'  Turn off the header from query responses.
'
    Call RS232WRITE(MSComm1, "HEADER OFF")
'
'  Set the horizontal timebase to display the calibrator signal and select
'  Channel 1 for display.
'
    WRT$ = ":CH1:VOLTS 2E-1;POSITION 0;OFFSET 0;COUPLING AC"
    Call RS232WRITE(MSComm1, WRT$)
    WRT$ = ":CH1:IMPEDANCE MEG;BANDWIDTH FULL"
    Call RS232WRITE(MSComm1, WRT$)
    WRT$ = ":HORIZONTAL:MAIN:SCALE 2E-4"
    WRT$ = ":SELECT:CH1 1"
    Call RS232WRITE(MSComm1, WRT$)
    
    Call RS232WAITCOM(MSComm1, 12)
'
'  Set up the measurement source to be channel 1; the type to amplitude, and
'  wait for the scope to display the waveform and the measurement.
'
    MEASSRC$ = "CH1": MEASTYPE$ = "AMPLITUDE"
    WRT$ = ":MEASUREMENT:MEAS1:SOURCE1 " + MEASSRC$ + ";TYPE " + MEASTYPE$ + ";STATE 1"
    Call RS232WRITE(MSComm1, WRT$)
    

     Call RS232WAITCOM(MSComm1, 12)
'
'  Print the display message for the user.
'
    msg = "The measurement for Ch1 and its amplitude are displayed on the scope" ' Define message.
    Title = "Meas Notify"                                  ' Define title.
    response = MsgBox(msg, Style, Title)
'
'  Unlock the front panel so the user can update the front panel.
'
    Call RS232WRITE(MSComm1, "UNLOCK ALL")
    
'
'  Close the comm port
'
    MSComm1.PortOpen = False
    
    StartButton.Enabled = True
End Sub

Private Sub Timer1_Timer()
    Call MsgBox("A timeout has occurred!")
    Stop
End Sub

⌨️ 快捷键说明

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