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

📄 ad.frm

📁 数据采集卡ART2002/1的VB原码 购买很贵的啊
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "ART2001"
   ClientHeight    =   4605
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7860
   Icon            =   "AD.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4605
   ScaleWidth      =   7860
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text_Val 
      Height          =   330
      Index           =   3
      Left            =   6240
      TabIndex        =   8
      Text            =   " "
      Top             =   1440
      Width           =   975
   End
   Begin VB.TextBox Text_Val 
      Height          =   330
      Index           =   2
      Left            =   4440
      TabIndex        =   7
      Text            =   " "
      Top             =   1440
      Width           =   975
   End
   Begin VB.TextBox Text_Val 
      Height          =   330
      Index           =   1
      Left            =   2640
      TabIndex        =   6
      Text            =   " "
      Top             =   1440
      Width           =   975
   End
   Begin VB.TextBox Text_Val 
      Height          =   330
      Index           =   0
      Left            =   840
      TabIndex        =   2
      Top             =   1440
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "采集数据"
      Height          =   615
      Left            =   3240
      TabIndex        =   0
      Top             =   2640
      Width           =   1695
   End
   Begin VB.Label Label4 
      Caption         =   "通道2"
      Height          =   255
      Left            =   3840
      TabIndex        =   5
      Top             =   1515
      Width           =   495
   End
   Begin VB.Label Label3 
      Caption         =   "通道3"
      Height          =   255
      Left            =   5640
      TabIndex        =   4
      Top             =   1515
      Width           =   495
   End
   Begin VB.Label Label2 
      Caption         =   "通道1"
      Height          =   255
      Left            =   2040
      TabIndex        =   3
      Top             =   1515
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "通道0"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   1515
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
    Dim hDevice                 As Long
    Dim DeviceID                As Integer
    Dim BaseAddress             As Integer
    Dim PerLsbVolt              As Single
    Dim ADPara                  As ART2001_PARA_AD
    Dim pADBuffer(0 To 8191)    As Integer
    Dim nReadSizeWords          As Integer
    Dim fVal As Single
    Dim str As String
    
Private Sub Command1_Click()

    PerLsbVolt = 20000# / 16384
    DeviceID = 0
    nReadSizeWords = 2048

    hDevice = ART2001_CreateDevice(BaseAddress)
    If (hDevice = -1) Then
        MsgBox "ART2001_CreateDevice Error..."
        Exit Sub
    End If

    ADPara.ADMode = ART2001_SEQUENCE_MODE      ' 连续采集和分组采集方式选择
    ADPara.FirstChannel = 0 ' 首通道号
    ADPara.LastChannel = 3 ' 末通道号
    ADPara.Frequency = 25000   ' 采集频率(Hz)
    ADPara.GroupInterval = 1000 ' 组间间隔(uS)
    ADPara.Gains = ART2001_1MULT_GAINS         ' 增益选择
    ADPara.TriggerSource = ART2001_IN_TRIGGER ' 内外触发源选择
    ADPara.ClockSource = ART2001_IN_CLOCK   ' 时钟源选择
    ADPara.GroundingMode = ART2001_SE_MODE  ' 接地方式(单端或双端选择)
    If ART2001_InitDeviceProAD(hDevice, ADPara) = False Then  ' 硬件参数, 它仅在此函数中决定硬件状态
        MsgBox "ART2001_InitDeviceProAD Error..."
    End If
    ART2001_StartDeviceProAD (hDevice)
    ART2001_ReadDeviceProAD_NotEmpty hDevice, pADBuffer(0), nReadSizeWords
    
    Dim i As Integer
    For i = 0 To 3 Step 1
    
        ' 按照-10V --- +10V 量程转换为电压值
        fVal = ((pADBuffer(i) Xor 8192) And 16383) * PerLsbVolt - 10000#
        str = fVal
        Text_Val(i).Text = Format(str, "0#.00")
        'printf("[CH0]=%6.2f\t[CH1]=%6.2f\n" , ((pADBuffer[i]^0x2000)&0x3FFF)*PerLsbVolt-10000.0, ((pADBuffer[i+1]^0x2000)&0x3FFF)*PerLsbVolt-10000.0)
    Next i
   
    ART2001_ReleaseDeviceProAD (hDevice)
    ART2001_ReleaseDevice (hDevice)

End Sub

⌨️ 快捷键说明

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