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

📄 frmspectrum.frm

📁 用VB实现正弦波的采集和傅里叶变换。将时域信号变化为频域信号
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Begin VB.Form FrmSpectrum 
   AutoRedraw      =   -1  'True
   BackColor       =   &H00C0C0C0&
   Caption         =   "单通道记录仪"
   ClientHeight    =   10710
   ClientLeft      =   60
   ClientTop       =   405
   ClientWidth     =   15240
   FillColor       =   &H00E0E0E0&
   BeginProperty Font 
      Name            =   "MS Sans Serif"
      Size            =   8.25
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   11100.24
   ScaleMode       =   0  'User
   ScaleWidth      =   15360
   StartUpPosition =   2  'CenterScreen
   WindowState     =   2  'Maximized
   Begin VB.CommandButton CmdAveraging 
      Caption         =   "平均"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   21
      Top             =   7200
      Width           =   855
   End
   Begin VB.TextBox TxtAveraging 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14400
      TabIndex        =   20
      Text            =   "10"
      Top             =   6600
      Width           =   495
   End
   Begin VB.OptionButton OptLine 
      BackColor       =   &H8000000B&
      Caption         =   "线性"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   14160
      TabIndex        =   19
      Top             =   5640
      Value           =   -1  'True
      Width           =   855
   End
   Begin VB.OptionButton Optlog 
      BackColor       =   &H8000000B&
      Caption         =   "对数"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   14160
      TabIndex        =   18
      Top             =   6120
      Width           =   855
   End
   Begin VB.PictureBox PicAmp 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00404040&
      BorderStyle     =   0  'None
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000C000&
      Height          =   4695
      Left            =   120
      ScaleHeight     =   4695
      ScaleWidth      =   735
      TabIndex        =   16
      Top             =   480
      Width           =   735
   End
   Begin VB.PictureBox PicTime 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H00404040&
      BorderStyle     =   0  'None
      ForeColor       =   &H0000FFFF&
      Height          =   375
      Left            =   120
      ScaleHeight     =   375
      ScaleWidth      =   13935
      TabIndex        =   15
      Top             =   5160
      Width           =   13935
   End
   Begin VB.PictureBox Pic0 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00404040&
      BorderStyle     =   0  'None
      ForeColor       =   &H0000C000&
      Height          =   4695
      Left            =   840
      ScaleHeight     =   4695
      ScaleWidth      =   13215
      TabIndex        =   14
      Top             =   480
      Width           =   13215
   End
   Begin VB.CommandButton CmdCh 
      Caption         =   "通道"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   13
      Top             =   1200
      Width           =   855
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   14760
      Top             =   9480
   End
   Begin MSComDlg.CommonDialog CmDialog1 
      Left            =   14400
      Top             =   8491
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   327680
      CancelError     =   -1  'True
      Filter          =   "数据文件|*.dat"
   End
   Begin VB.PictureBox PicFreq 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H00404040&
      BorderStyle     =   0  'None
      ForeColor       =   &H0000FFFF&
      Height          =   375
      Left            =   120
      ScaleHeight     =   375
      ScaleWidth      =   13935
      TabIndex        =   11
      Top             =   10200
      Width           =   13935
   End
   Begin VB.CommandButton CmdGM 
      Caption         =   "放大-"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   10
      Top             =   2760
      Width           =   855
   End
   Begin VB.PictureBox PicAg 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00404040&
      BorderStyle     =   0  'None
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000C000&
      Height          =   4695
      Left            =   120
      ScaleHeight     =   4695
      ScaleWidth      =   735
      TabIndex        =   9
      Top             =   5520
      Width           =   735
   End
   Begin VB.CommandButton CmdFP 
      Caption         =   "频率+"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   8
      Top             =   4080
      Width           =   855
   End
   Begin VB.CommandButton CmdRead 
      Caption         =   "回读"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   6
      Top             =   8040
      Width           =   855
   End
   Begin VB.CommandButton CmdSave 
      Caption         =   "保存"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   5
      Top             =   9000
      Width           =   855
   End
   Begin VB.CommandButton CmdfM 
      Caption         =   "频率-"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   4
      Top             =   3480
      Width           =   855
   End
   Begin VB.PictureBox Pic1 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00404040&
      BorderStyle     =   0  'None
      ForeColor       =   &H0000C000&
      Height          =   4695
      Left            =   840
      ScaleHeight     =   4695
      ScaleWidth      =   13215
      TabIndex        =   3
      Top             =   5520
      Width           =   13215
   End
   Begin VB.CommandButton CmdSample 
      Caption         =   "采样"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   2
      Top             =   480
      Width           =   855
   End
   Begin VB.CommandButton cmdGp 
      Caption         =   "放大+"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   1
      Top             =   2160
      Width           =   855
   End
   Begin VB.CommandButton CmdEnd 
      Cancel          =   -1  'True
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14280
      TabIndex        =   0
      Top             =   9960
      Width           =   855
   End
   Begin VB.Timer TimerSample 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   14280
      Top             =   9480
   End
   Begin VB.Label LblFmax 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Left            =   14160
      TabIndex        =   17
      Top             =   4800
      Width           =   975
   End
   Begin VB.Label LblCh 
      Height          =   255
      Left            =   1440
      TabIndex        =   12
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label LblFreq 
      Height          =   255
      Left            =   6720
      TabIndex        =   7
      Top             =   120
      Width           =   1815
   End
End
Attribute VB_Name = "FrmSpectrum"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim dd1(40960)     As Integer         '采样结果存放

Private fr(10)     As Integer         '采样频率数组
Private fcode      As Integer         '频率码
Private kf         As Integer         '采样频率号
Private ndraw      As Integer         '显示点数
Private gain       As Integer         '程控放大倍数
Private ch         As Integer         '通道号
Private LogFlag    As Boolean         '对数标志

Private Sub CmdAveraging_Click()
Dim navg As Integer

  TimerSample.Enabled = False
  navg = Val(TxtAveraging.Text)
  Call minit(husb, ch, 1, gain)
  Call readdata(husb, dd1(0), fcode, ndraw * navg)

  Pic1.Cls
  Call DrawPower(navg)
  Call Background1

End Sub

Private Sub CmdCh_Click()

⌨️ 快捷键说明

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