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

📄 da_module.bas

📁 此为用vb编写的usb高速数据采集实例 如果没有相应的驱动
💻 BAS
字号:
Attribute VB_Name = "DA_Module"
Option Explicit
Public hDevice As Long
Public bDeviceRun0 As Boolean
Public bDeviceRun1 As Boolean
Public hWriteDAThread0 As Long    '第0通道子线程句柄
Public hWriteDAThread1 As Long  ' 第0通道子线程句柄
Public pDABuffer(0 To 16383) As Long
Public Cycle0 As Integer
Public Cycle1 As Integer
Dim II As Long


Function WriteDAFunction0() As Long

    Dim i As Long
    Dim k As Long
    Dim DAData As Long
    Dim channelN As Integer
    Dim bStatus As Boolean
    Dim str As String
    Dim DeviceID As Long
    channelN = DA_Form.Combo2
    DeviceID = 0       ' 设当前被操作的PCI设备只有一个
    hDevice = USB2013_CreateDevice(DeviceID)    '创建设备对象
    If hDevice = INVALID_HANDLE_VALUE Then
        II = MessageBox(DA_Form.hwnd, "创建设备对象失败...", "Error", 0)
        Exit Function
    End If

    Do While DA_Module.bDeviceRun0
    
      If DA_Form.Check1.Value = 0 Then
         For i = 0 To 4095
           pDABuffer(i) = Fix(Sin((6.28 * i) / DA_Form.Cycle0) * 2048 + 2047)
           bStatus = USB2013_WriteDeviceDA(hDevice, pDABuffer(i), channelN)
         Next i
      ElseIf DA_Form.Check1.Value = 1 Then
           pDABuffer(0) = DA_Form.Text1.Text
           bStatus = USB2013_WriteDeviceDA(hDevice, pDABuffer(0), channelN)
      End If
      
      Call DA_Form.DAWave
    Loop

End Function

    

⌨️ 快捷键说明

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