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

📄 testapi.frm

📁 硬件FlashDso的程序实现
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "FlashDSO XP Test API"
   ClientHeight    =   8190
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   11760
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   8190
   ScaleWidth      =   11760
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      Height          =   270
      Left            =   2640
      TabIndex        =   30
      Text            =   "Text1"
      Top             =   7560
      Width           =   2175
   End
   Begin VB.Frame Frame7 
      Caption         =   "衰减比例选择"
      Height          =   1575
      Left            =   8400
      TabIndex        =   26
      Top             =   6360
      Width           =   3015
      Begin VB.OptionButton Option29 
         Caption         =   "X20"
         Height          =   180
         Left            =   840
         TabIndex        =   29
         Top             =   1200
         Width           =   735
      End
      Begin VB.OptionButton Option28 
         Caption         =   "X10"
         Height          =   180
         Left            =   840
         TabIndex        =   28
         Top             =   780
         Width           =   615
      End
      Begin VB.OptionButton Option27 
         Caption         =   "X1"
         Height          =   180
         Left            =   840
         TabIndex        =   27
         Top             =   360
         Width           =   615
      End
   End
   Begin VB.Frame Frame4 
      Caption         =   "藕合方式选择"
      Height          =   1215
      Left            =   8400
      TabIndex        =   6
      Top             =   4800
      Width           =   3015
      Begin VB.OptionButton Option26 
         Caption         =   "交流"
         Height          =   180
         Left            =   720
         TabIndex        =   25
         Top             =   840
         Width           =   855
      End
      Begin VB.OptionButton Option25 
         Caption         =   "直流"
         Height          =   180
         Left            =   720
         TabIndex        =   24
         Top             =   360
         Width           =   855
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "触发方式选择"
      Height          =   1935
      Left            =   8400
      TabIndex        =   5
      Top             =   2640
      Width           =   3015
      Begin VB.OptionButton Option24 
         Caption         =   "上升沿触发"
         Height          =   255
         Left            =   600
         TabIndex        =   23
         Top             =   960
         Width           =   1215
      End
      Begin VB.OptionButton Option23 
         Caption         =   "下降沿触发"
         Height          =   180
         Left            =   600
         TabIndex        =   22
         Top             =   1440
         Width           =   1215
      End
      Begin VB.OptionButton Option22 
         Caption         =   "自动触发"
         Height          =   255
         Left            =   600
         TabIndex        =   21
         Top             =   480
         Width           =   1095
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "采样频率选择"
      Height          =   2175
      Left            =   8400
      TabIndex        =   4
      Top             =   240
      Width           =   3015
      Begin VB.OptionButton Option21 
         Caption         =   "8K"
         Height          =   255
         Left            =   2040
         TabIndex        =   20
         Top             =   1800
         Width           =   615
      End
      Begin VB.OptionButton Option20 
         Caption         =   "20K"
         Height          =   255
         Left            =   1200
         TabIndex        =   19
         Top             =   1800
         Width           =   615
      End
      Begin VB.OptionButton Option19 
         Caption         =   "40K"
         Height          =   255
         Left            =   240
         TabIndex        =   18
         Top             =   1800
         Width           =   615
      End
      Begin VB.OptionButton Option18 
         Caption         =   "80K"
         Height          =   255
         Left            =   2040
         TabIndex        =   17
         Top             =   1320
         Width           =   615
      End
      Begin VB.OptionButton Option17 
         Caption         =   "200K"
         Height          =   255
         Left            =   1200
         TabIndex        =   16
         Top             =   1320
         Width           =   735
      End
      Begin VB.OptionButton Option16 
         Caption         =   "400K"
         Height          =   255
         Left            =   240
         TabIndex        =   15
         Top             =   1320
         Width           =   855
      End
      Begin VB.OptionButton Option15 
         Caption         =   "800K"
         Height          =   255
         Left            =   2040
         TabIndex        =   14
         Top             =   840
         Width           =   735
      End
      Begin VB.OptionButton Option14 
         Caption         =   "2M"
         Height          =   255
         Left            =   1200
         TabIndex        =   13
         Top             =   840
         Width           =   615
      End
      Begin VB.OptionButton Option13 
         Caption         =   "4M"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   840
         Width           =   615
      End
      Begin VB.OptionButton Option12 
         Caption         =   "8M"
         Height          =   255
         Left            =   2040
         TabIndex        =   11
         Top             =   360
         Width           =   615
      End
      Begin VB.OptionButton Option11 
         Caption         =   "20M"
         Height          =   255
         Left            =   1200
         TabIndex        =   10
         Top             =   360
         Width           =   615
      End
      Begin VB.OptionButton Option10 
         Caption         =   "40M"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   360
         Width           =   615
      End
   End
   Begin VB.PictureBox Picture2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   3135
      Left            =   240
      ScaleHeight     =   3105
      ScaleWidth      =   7785
      TabIndex        =   3
      Top             =   3960
      Width           =   7815
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   3135
      Left            =   240
      ScaleHeight     =   3105
      ScaleWidth      =   7785
      TabIndex        =   2
      Top             =   360
      Width           =   7815
   End
   Begin VB.CommandButton Command2 
      Caption         =   "结束采集"
      Height          =   495
      Left            =   6000
      TabIndex        =   1
      Top             =   7440
      Width           =   2055
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始采集"
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Top             =   7440
      Width           =   2175
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Left            =   5520
      Top             =   7440
   End
   Begin VB.Frame Frame5 
      Caption         =   "CH1波形"
      Height          =   3495
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   8055
   End
   Begin VB.Frame Frame6 
      Caption         =   "CH2波形"
      Height          =   3495
      Left            =   120
      TabIndex        =   8
      Top             =   3720
      Width           =   8055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'//=================================================================================================
'//
'//   SoundADC 是一个共享软件,作者享有一切权利。您可以自由使用、复
'// 制、传播、发布此软件的试用版;未经作者书面认可,任何人不得作任何
'// 修改或用于商业用途。
'//   违者作者将追究其最大责任。
'//
'//   请仔细阅读以下使用许可,如果您不同意以下任何一点,请立即停止使
'// 用此软件:
'//   1. 本软件产品的版权归兄弟工作室所有,受到版权法及其他知识产权法
'//      及条约的保护。
'//   2. 本软件作者兄弟工作室授予您对此版本的最终用户使用许可权。
'//   3. 您不能对此软件作任何的软件反向工程,如反汇编,跟踪等,并且
'//      不能对此软件作非法篡改。
'//   4. 您可以自由使用、复制、传播、发布此软件的试用版,但未征得作
'//      者同意的情况下,您不能收取任何费用或用于商业目的,如销售,
'//      捆绑,集成等。同时,必须保证所分发的软件包含全部文件,并且
'//      未作任何修改。
'//   5. 本软件作者将不会对使用本软件所引起的其他事件负有任何责任。
'//   6. 如果您想继续使用本软件所有功能,必须将其注册为正式版。
'//
'//                 http://www.ost2002.com
'//
'//     版权所有(c) 1998-2006 OST2002.COM 兄弟工作室 保留所有权利
'//=================================================================================================

Dim iPort As Byte

Dim ff(8) As Byte
Dim ChannelData1(2048) As Byte
Dim ChannelData2(2048) As Byte

Private Sub Command1_Click()
    '初始ADC
    OpenDSO iPort
    SetAutoTriger
    SetClock VA_TIMEBASE_0
    SetGain VA_OP_X0
    SetAC
    
    '定时器为1秒
    Timer1.Interval = 200
    Timer1.Enabled = True
    Command1.Enabled = False
    Command2.Enabled = True
End Sub

Private Sub Command2_Click()
    '清理ADC
    StopDSO
    ShutDSO
    
    Timer1.Enabled = False
    Command1.Enabled = True
    Command2.Enabled = False
End Sub


Private Sub Form_Load()
    '自动获取连接端口
    iPort = GetPort
    If iPort = 0 Then
        Command1.Enabled = False
        Text1.Text = "没有连接FlashDSO"
    Else
        Command1.Enabled = True
        Text1.Text = "成功连接FlashDSO"
    End If
End Sub

Private Sub Form_Close()
    '清理ADC
    StopDSO
    ShutDSO
    
    Timer1.Enabled = False
    Command1.Enabled = True
    Command2.Enabled = False
End Sub

Private Sub Option10_Click()
    '设置采样率
    SetClock VA_TIMEBASE_0
End Sub

Private Sub Option11_Click()
    '设置采样率
    SetClock VA_TIMEBASE_1
End Sub

Private Sub Option12_Click()
    '设置采样率
    SetClock VA_TIMEBASE_2
End Sub

Private Sub Option13_Click()
    '设置采样率
    SetClock VA_TIMEBASE_3
End Sub

Private Sub Option14_Click()
    '设置采样率
    SetClock VA_TIMEBASE_4
End Sub

Private Sub Option15_Click()
    '设置采样率
    SetClock VA_TIMEBASE_5
End Sub

Private Sub Option16_Click()
    '设置采样率
    SetClock VA_TIMEBASE_6
End Sub

Private Sub Option17_Click()
    '设置采样率
    SetClock VA_TIMEBASE_7
End Sub

Private Sub Option18_Click()
    '设置采样率
    SetClock VA_TIMEBASE_8
End Sub

Private Sub Option19_Click()
    '设置采样率
    SetClock VA_TIMEBASE_9

End Sub

Private Sub Option20_Click()
    '设置采样率
    SetClock VA_TIMEBASE_10
End Sub

Private Sub Option21_Click()
    '设置采样率
    SetClock VA_TIMEBASE_11
End Sub

Private Sub Option22_Click()
    '设置触发模式
    SetAutoTriger
End Sub

Private Sub Option23_Click()
    '设置触发模式
    SetFallTriger
End Sub

Private Sub Option24_Click()
    '设置触发模式
    SetRiseTriger
End Sub

Private Sub Option25_Click()
    '设置直流藕合
    SetDC
End Sub

Private Sub Option26_Click()
    '设置交流藕合
    SetAC
End Sub

Private Sub Option27_Click()
    '设置信号衰减比例
    SetGain VA_OP_X0
End Sub

Private Sub Option28_Click()
    '设置信号衰减比例
    SetGain VA_OP_X1
End Sub

Private Sub Option29_Click()
    '设置信号衰减比例
    SetGain VA_OP_X2
End Sub

Private Sub Timer1_Timer()
    Dim iCurrData As Integer
    
    StartDSO
    '获取ADC数据。
    ReadDSOData ChannelData1(0), ChannelData2(0)
    
    Picture1.Scale (0, 0)-(300, 200)
    iCurrData = 150 - ChannelData1(0)
    '显示一通道内容
    Picture1.Refresh
    
    Picture1.PSet (0, iCurrData)

    For i = 0 To 400
        Picture1.Line (i, 150 - ChannelData1(i) / 2)-(i + 1, 150 - ChannelData1(i + 1) / 2)
    Next i
    
    '显示二通道内容
    Picture2.Refresh
    
    Picture2.Scale (0, 0)-(300, 200)
    iCurrData = 150 - ChannelData2(0)
    
    Picture2.PSet (0, iCurrData)
    For i = 0 To 400
        Picture2.Line (i, 150 - ChannelData2(i) / 2)-(i + 1, 150 - ChannelData2(i + 1) / 2)
    Next i
End Sub

⌨️ 快捷键说明

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