信号发生器:汉泰克1025G
SDK开发资料:http://www.hantek.com.cn/products/detail/48
1.python接口
网上已经有大神制作了python的封装接口:https://github.com/AIMAtlanta/Hantek_1025G
这里为了方便查找就再张贴一遍:
# -*- coding: utf-8 -*-
"""
origin source: https://github.com/AIMAtlanta/Hantek_1025G
Python wrapper providing access to C-language API provided by HTDDSDll.h.
Example usage:
ht = HantekDDS()
ht.drive_periodic(amplitude=2.0, frequency=12000., function = 'sine')
"""
import ctypes
import os
import numpy as np
import threading
import time
import matplotlib.pyplot as plt
this_dir = os.path.dirname(os.path.realpath(__file__))
HTDLL = ctypes.windll.LoadLibrary(this_dir + '/HTDDSDll')
FMAX = 200e6 # Maximum DAC sample rate
class HantekDDS():
""" Interface to Hantek 1025G function generator."""
def __init__(self, dev=0):
""" Default constructor."""
self.idVendor = '0x0483'
self.idProduct = '0x5726'
self.revNumber = '0200'
self.dev_id = None
self.connect(dev)
self.param_dict = {'square_duty': 0.5,
'triangle_duty': 0.5,
'trap_rise': 0.2,
'trap_high': 0.3,
'trap_fall': 0.2,
'exp_mode': 'decay',
'exp_time': 0.001,
}
self.halt = False
def connect(self, dev=0):
""" Verify existence of device and get device id."""
for attempt in range(10):
n_devices = search()
if n_devices:
if bool(check(dev)):
self.dev_id = dev
print('Connected as device {:d}'.format(dev))
return
print('ERROR: Failed to establish connection with HantekDDS.')
def set_divisor(self, div):
""" Set the DAC sample rate divisor."""
setDivNum(self.dev_id, div)
def set_waveform(self, data):
""" Set the waveform buffer."""
data = np.array(data) # Ensure data is in ndarray
dlen = len(data)
if dlen > 4096:
print('WARNING: Hantek 1025G buffer limited to 4096 samples -- ' +
'Truncating data to 4096 elements')
data = data[:4096]
if download(self.dev_id, data.tobytes(), dlen):
pass
else:
print('HantekDDS method set_waveform() returned failure code.')
def drive_periodic(self, amplitude=1.0, frequency=1000.0,
offset=0, phase=0, function='sine', **kwargs):
""" Direct the device to drive a periodic function.
Args:
amplitude: Amplitude of signal in Volts (1/2 V_pp)
frequency: Frequency of signal in Hertz
offset: Offset of signal in Volts.
phase: Offset of phase in periods (phase = 0 is equivalent to
phase=1, phase = 0.5 is 180 degrees out of phase from phase = 0.
function: Type of periodic function to drive.
Valid Types
-----------
'sine': Sine wave
'square': Square wave, param 'square_duty' for high duty cycle
specified as float in range (0,1)
'triangle': Triangle wave, param 'duty' for rise duty cycle
specified as float in range (0,1)
'ramp': Synonym for 'triangle'
'sawtooth': Synonym for 'triangle'
'trap': Trapezoidal wave, params 'trap_rise', 'trap_high',
and 'trap_fall' for duty cycle for rise, high, and fall
segments specified as floats > 0 with sum <= 1.
'exp': Exponential wave, params 'exp_mode' (may be 'rise' or
'saturate') and 'exp_time' (time constant in seconds).
"""
for key,val in kwargs.items():
if key in self.param_dict:
self.param_dict[key] = val
frequency = validate_frequency(frequency)
phase = phase % 1
if (amplitude + abs(offset)) > 3.5:
print('WARNING: amplitude and offset specified will cause ' +
'the signal to be clipped. Consider confining the range ' +
'to ±3.5 volts.')
if function not in periodic_functions.keys():
print('WARNING: function type for periodic function not found. ' +
'Valid values are ' +
'Defaulting to sine wave.')
function = 'sine'
div, length = get_freq_settings(frequency)
print(f'freq:{frequency}, div:{div}, length:{length}')
f = periodic_functions[function]
signal = f(amplitude, frequency, offset, phase,
length, **(self.param_dict))
digital = np.short(voltage_adc(signal))
print(digital)
self.set_waveform(digital)
self.set_divisor(div)
def frequency_scan(self, f_start, f_end, nsteps=10, delta=0, dwell=5,
ltype='linear', n_repeats=1, amplitude=1.0, offset=0.0):
""" Scan through a range of frequencies.
Args:
f_start: Scan starting frequency in Hertz
f_end: Scan ending frequency in Hertz
nsteps: The number of steps to take between f_start and f_end.
delta: The arithmetic or geometric difference between steps.
If non-zero, this setting will override nsteps.
Additionally, the frequency sweep may go past f_end.
n_repeats: The number of times to loop through the entire frequency
scan. Set to -1 to make continuous.
"""
f_start = validate_frequency(f_start)
f_end = validate_frequency(f_end)
if ltype in ['log', 'logarithmic']:
if delta > 0:
nsteps = np.ceil(np.log(f_end / f_start) / np.log(delta))
fspace = np.product(np.append(f_start, delta*np.ones(nsteps)))
else:
fspace = np.logspace(np.log10(f_start),
np.log10(f_end), nsteps)
if ltype in ['lin', 'linear']:
if delta != 0:
fspace = np.arange(f_start, f_end + delta, delta)
else:
fspace = np.linspace(f_start, f_end, nsteps)
fspace = np.linspace(f_start, f_end, nsteps)
self.scanner = threading.Thread(target=self.freq_scan_threaded,
args=(fspace, amplitude,
offset, dwell, n_repeats))
self.halt = False
self.scanner.start()
# self.freq_scan_threaded(fspace, amplitude, offset, dwell, n_repeats)
def freq_scan_threaded(self, fspace, amp, offset, dwell, n_repeats):
""" Frequency scan to be started in non-blocking threaded process."""
queue = int(n_repeats)
while queue != 0:
queue -= 1
for f in fspace:
if self.halt:
return None
self.drive_periodic(amplitude=amp, frequency=f, offset=offset)
time.sleep(dwell)
def stop(self):
""" Halt the threaded scan process."""
self.halt = True
def search():
""" Search for connected Hantek DDS devices.
Will not return identity of devices, only the number connected.
"""
fh = HTDLL[7] # function handle for DDSSearch()
return fh()
def setFrequency(dev, f, npoints, nperiods):
""" Set parameters appropriate for a particular frequency.
Args:
f: frequency to be set
"""
fh = HTDLL[11]
return fh(dev, f, npoints, nperiods)
def getMeasure():
""" Retrieve the value from the frequency/counter function."""
raise NotImplementedError
def setSingleWave(dev, state):
""" Set device to output continuously, or to output only on trigger."""
fh = HTDLL[13]
fh(dev, state)
def resetCounter():
""" Reset the count of the counter function."""
fh = HTDLL[6]
return fh(dev)
def setTrigger(dev, internal, falling):
""" Set trigger parameters."""
fh = HTDLL[14]
return fh(dev, internal, falling)
def setDigitalIn():
""" Read input values (low or high) from digital input ports.
Lowest four bits of the read array are read from the 4 input pins.
"""
raise NotImplementedError
def setDIOMode():
""" Switch between programmable output and generator output."""
raise NotImplementedError
def setDigitalOut():
""" Set the output values (low or high) of the digital output ports.
Lowest twelve bits of the output array are set on the 12 output pins.
"""
raise NotImplementedError
def download(dev, buf, num):
""" Transfer a waveform specification to the device waveform buffer.
Args:
dev: Device index
buf: Pointer to short type array (only 12 bits used)
num: Number of elements in buffer
Returns:
bool: 1 on success, 0 on failure
"""
fh = HTDLL[2]
return fh(dev, buf, num)
def check(dev):
""" Check the status of the device.
Determine whether or not the device can be seen by the operating system
Args:
dev: Index of Hantek device.
Returns:
bool: status of connection (True = success, False = failure)
Argument ``dev`` seems to be an internal index, presumably out of the
number of Hantek devices connected. If only one Hantek device is
connected, ``dev`` should probably always be 0.
"""
fh = HTDLL[1]
return fh(dev)
def setPowerOnOutput(dev, state):
""" Set whether waveform should output upon device power-on
If true, output stored function. Otherwise, wait for a trigger (?) or
explicit command to output.
"""
fh = HTDLL[12]
return fh(dev, state)
def getDivNum(dev):
""" Get the DAC frequency divisor
Args:
dev: device index
Returns:
int: Divisor index number
"""
fh = HTDLL[4]
return fh(dev)
def setDivNum(dev, div):
""" Set the DAC sampling rate divisor.
Args:
div: divisor to apply to DAC sampling frequency.
Values of div from 1:n give sampling rates of fmax / (2 * div).
When div == 0, sampling rate is ``FMAX`` = 200MS/sec.
"""
fh = HTDLL[10]
return fh(dev, div)
def validate_frequency(frequency):
if frequency > 1e8:
print('WARNING: frequency {:g} is outside the '.format(frequency) +
'possible range of frequencies for the Hantek 1025G. ' +
'Setting frequency to 10MHz for your "convenience".')
frequency = 1e7
if frequency < 1:
print('WARNING: frequency {:g} is outside the '.format(frequency) +
'possible range of frequencies for the Hantek 1025G. ' +
'Setting frequency to 10Hz for your "convenience".')
frequency = 10
return frequency
def get_freq_settings(frequency):
""" Compute the DAC divisor and sample length for a a target frequency.
Args:
frequency: Target frequency in Hertz.
Returns:
int: divisor to be passed to setDivNum
int: length to be passed to signal synthesis routines
This function returns the same information that setFrequency does, but
without modifying the DAC divisor.
"""
frequency = validate_frequency(frequency)
divisor = int(FMAX/4096/frequency)
length = int(FMAX / max(1, 2 * divisor) / frequency)
return divisor, length
def voltage_adc(voltage):
""" Convert voltage in the range from -3.5V to +3.5V to a 12-bit level."""
return np.minimum(4095, np.maximum(0, (3.5 - voltage) / 1.70898375e-3))
# Periodic Functions
# ==================
def sine_wave(amplitude, frequency, offset, phase, length, **kwargs):
""" Construct one period of a sine wave."""
arg = np.linspace(0, 2*np.pi, length, endpoint=False)
signal = amplitude * np.sin(arg) + offset
return np.roll(signal, int(phase * length))
def square_wave(amplitude, frequency, offset, phase, length, **kwargs):
""" Construct one period of a square wave."""
duty = kwargs['square_duty']
cutoff = int(duty * length)
signal = np.empty(length)
signal[:cutoff] = amplitude + offset
signal[cutoff:] = -amplitude + offset
return np.roll(signal, int(phase * length))
def triangle_wave(amplitude, frequency, offset, phase, length, **kwargs):
""" Construct one period of a triangle (sawtooth, ramp) wave."""
duty = kwargs['triangle_duty']
signal = np.empty(length)
cutoff = int(duty * length)
signal[:cutoff] = np.linspace(-amplitude, amplitude,
cutoff, endpoint=False)
signal[cutoff:] = np.linspace(amplitude, -amplitude,
length - cutoff, endpoint=False)
signal += offset
return np.roll(signal, int(phase * length))
def exponential(amplitude, frequency, offset, phase, length, **kwargs):
""" Construct an exponentially decaying/saturating wave."""
tau = kwargs['exp_time']
exp_mode = kwargs['exp_mode']
time = np.linspace(0, 1/frequency, length, endpoint=False)
if exp_mode == 'saturate':
signal = amplitude * (1 - np.exp(-time / tau) + offset)
if exp_mode == 'decay':
signal = amplitude * (np.exp(-time / tau) + offset)
return np.roll(signal, int(phase * length))
def trapezoid(amplitude, frequency, offset, phase, length, **kwargs):
""" Construct a trapezoidal wave."""
d_rise = kwargs['trap_rise']
d_high = kwargs['trap_high']
d_fall = kwargs['trap_fall']
if d_high + d_rise + d_fall > 1:
print('Duty cycle greater than 1 specified for trapezoidal wave. ' +
'Reseting to reasonable parameters.')
d_rise = 0.2
d_high = 0.3
d_fall = 0.2
l_r = c_r = int(d_rise * length)
l_h = int(d_high * length)
c_h = c_r + l_h
l_f = int(d_fall * length)
c_f = c_h + l_f
signal = np.empty(length)
signal[:c_r] = np.linspace(-amplitude, amplitude, l_r, endpoint=False)
signal[c_r:c_h] = amplitude
signal[c_h:c_f] = np.linspace(amplitude, -amplitude, l_f, endpoint=False)
signal[c_f:] = -amplitude
return np.roll(signal, int(phase * length))
def arbitrary(amplitude, frequency, offset, phase, length, **kwargs):
""" 创建任意波波形."""
# 数据范围
num = 10000
M = 1e6
n = 1e-9
t = np.arange(0, 1000*n, (1000/num)*n) # Only need to modify the parameters on lines 15-22
# t = np.arange(0, 1000*n, 0.005*n)
j = 1j
ts = 50*n # Duration 50
f0 = 30*M # Frequency center 450
fb = 100*M # Bandwidth 100
a = 1/(2*ts**2)
b = np.sqrt((2*(np.pi**2)*(a**2))/((ts**2)*a)-2*(np.pi**2))
A = (a/np.pi)**(1/4) # Amplitude
t0 = 500*n # Time center
w0 = 2*np.pi*f0 # Frequency center
# Incident wave function
s = A*np.exp((-0.5*a*((t-t0)**2))+(j*0.5*b*((t-t0)**2))+j*w0*(t-t0))
s = np.real(s)
s_max = np.max(s)
# 注意这里要进行转换
s = np.floor((2**11-1)*(s/s_max))
shift = len(s)//length # 原始数据长度5500
signal = amplitude*(s/2048.0)[::shift]
print('任意波数据长度:', len(signal))
signal += offset
plt.plot(signal)
plt.show()
return np.roll(signal, int(phase * length))
# Dictionary of all periodic functions
periodic_functions = {'sine': sine_wave,
'square': square_wave,
'triangle': triangle_wave,
'sawtooth': triangle_wave,
'ramp': triangle_wave,
'trap': trapezoid,
'exp': exponential,
'arb': arbitrary
}
if __name__ == '__main__':
# signal = arbitrary(amplitude=1, frequency=1000000, offset=0, phase=1, length=200,)
ht = HantekDDS()
# 任意波
ht.drive_periodic(amplitude=3.5, frequency=2500000., function = 'arb')
上面python接口一个精妙的写法是使用索引的方式获取了函数句柄,例如DDSCheck
函数为fh = HTDLL[1]
,但是问题来了,原作者是如何知道不同函数对应的索引值?经过一番查找,笔者发现可以使用DDL函数查看器
(自行搜索下载)实现查找,如下图所示:
由于官方提供的.dll和.lib文件都是32位的,因此上述程序需要在32位python环境运行
2.C接口
官方提供了VC例程,但是项目太老不容易用新版的VS打开,而且很多时候只需要简单的几个指令即可,下面贴出1025G下载任意波形的代码,注意波形点数和频率有关:
1025G最大采样率为200MS/s(200e6),如果任意波波形频率为100M,即一个周期1us,1us时间在200MS/s采样率下可以采集200个点,因此100M频率任意波形的数据缓冲大小为200,其它以此类推,计算公式如下,其中freq为需要下载波形的频率,FMAX为信号发生器采样频率,这里默认为200MS/s,也可以设置分频系数进行调整
点数 = 1 f r e q 1 F M A X 点数=\frac{\frac{1}{freq}}{\frac{1}{FMAX}} 点数=FMAX1freq1
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <cmath>
#include <cstdint>
#include "HTDDSDll.h"
#pragma comment(lib, "HTDDSDll.lib") // 使用库
#define BUF_SIZE 4096
#define MAX_VOLT 3.5f
typedef unsigned short USHORT;
int main(int argc, char *argv[])
{
int device_index = 0;
double frequency = 1e6;
int wave_point_num = 200; // 1M->200,2M->100,
int wave_period_num = 1;
bool downStatus = false; // 波形下载状态
BOOL device_available;
// BOOL result_set_frequency;
// 搜索设备
printf(">>> Searching DDS devices...\n");
int result_search = DDSSearch();
if (result_search > 0)
{
printf("Found %d devices!\n", result_search);
}
else
{
printf("!!! Device not found@\n");
return -1;
}
// 检查设备是否可用
printf(">>> Checking DDS devices...\n");
device_available = DDSCheck(device_index);
if (device_available)
{
printf("Device available!\n");
}
else
{
printf("!!! Device not available!\n");
return -1;
}
// 设置频率
// result_set_frequency = DDSSetFrequency(device_index, frequency, &wave_point_num, &wave_period_num);
// if (result_set_frequency) {
// printf("Frequency set successfully!\n");
// } else {
// printf("频率设置失败\n");
// return -1;
// }
// 创建波形
USHORT buffer1M[BUF_SIZE] = {2048, 2049, 2049, 2048, 2049, 2049, 2048, 2049, 2049, 2048, 2048, 2049, 2048, 2048,
2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049,
2048, 2048, 2048, 2049, 2049, 2048, 2048, 2048, 2049, 2049, 2049, 2048, 2048, 2048,
2049, 2049, 2049, 2049, 2048, 2047, 2046, 2047, 2048, 2051, 2054, 2057, 2056, 2053,
2047, 2039, 2029, 2020, 2011, 2005, 2002, 2002, 2006, 2012, 2020, 2030, 2039, 2046,
2048, 2045, 2030, 2002, 1955, 1884, 1789, 1669, 1533, 1399, 1295, 1263, 1347, 1583,
1981, 2495, 3015, 3370, 3376, 2918, 2048, 1045, 359, 422, 1360, 2784, 3877, 3846,
2553, 823, 1, 874, 2795, 4020, 3302, 1313, 181, 1201, 3160, 3630, 2048, 603,
1283, 2982, 3107, 1602, 1003, 2189, 2957, 2035, 1295, 2059, 2658, 1972, 1579, 2213,
2367, 1818, 1894, 2287, 2048, 1873, 2149, 2111, 1935, 2085, 2100, 1983, 2069, 2075,
2011, 2067, 2055, 2030, 2064, 2044, 2045, 2056, 2042, 2052, 2048, 2047, 2051, 2047,
2050, 2048, 2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049,
2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049,
2048, 2049, 2048, 2048, 2049, 2048, 2049, 2048, 2048, 2049, 2048, 2049, 2048, 2048,
2049, 2048, 2049, 2049};
USHORT buffer2M[BUF_SIZE] = {2048, 2048, 2049, 2049, 2048, 2049, 2048, 2048, 2049, 2048, 2049, 2048, 2049, 2048, 2049,
2048, 2048, 2049, 2048, 2049, 2049, 2048, 2049, 2049, 2048, 2046, 2048, 2054, 2056,
2047, 2029, 2011, 2002, 2006, 2020, 2039, 2048, 2030, 1955, 1789, 1533, 1295, 1347,
1981, 3015, 3376, 2048, 359, 1360, 3877, 2553, 1, 2795, 3302, 181, 3160, 2048,
830, 3107, 1003, 2957, 1295, 2658, 1579, 2367, 1894, 2048, 2149, 1935, 2100, 2069,
2011, 2055, 2064, 2045, 2042, 2048, 2051, 2050, 2048, 2048, 2048, 2048, 2048, 2048,
2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2049, 2049, 2048, 2048, 2048,
2049, 2049};
USHORT buffer500k[BUF_SIZE] = {2048, 2048, 2049, 2049, 2049, 2048, 2048, 2048, 2048, 2049, 2049, 2049, 2048, 2048, 2048, 2049, 2049, 2049, 2048, 2048, 2048,
2049, 2049, 2049, 2048, 2048, 2048, 2048, 2049, 2049, 2049, 2048, 2048, 2048, 2049,
2049, 2049, 2049, 2048, 2048, 2048, 2048, 2049, 2049, 2049, 2049, 2048, 2048, 2048,
2048, 2049, 2049, 2049, 2049, 2048, 2048, 2048, 2048, 2049, 2049, 2049, 2049, 2049,
2048, 2048, 2048, 2048, 2048, 2049, 2049, 2049, 2049, 2049, 2048, 2048, 2048, 2048,
2048, 2049, 2049, 2049, 2049, 2049, 2049, 2048, 2048, 2048, 2048, 2048, 2048, 2048,
2049, 2049, 2049, 2049, 2049, 2049, 2049, 2049, 2048, 2047, 2047, 2046, 2046, 2046,
2047, 2047, 2048, 2050, 2051, 2053, 2054, 2056, 2057, 2057, 2056, 2055, 2053, 2051,
2047, 2044, 2039, 2034, 2029, 2024, 2020, 2015, 2011, 2008, 2005, 2003, 2002, 2001,
2002, 2003, 2006, 2008, 2012, 2016, 2020, 2025, 2030, 2034, 2039, 2042, 2046, 2048,
2048, 2048, 2045, 2039, 2030, 2018, 2002, 1981, 1955, 1923, 1884, 1840, 1789, 1731,
1669, 1602, 1533, 1464, 1399, 1341, 1295, 1268, 1263, 1288, 1347, 1445, 1583, 1763,
1981, 2228, 2495, 2764, 3015, 3225, 3370, 3427, 3376, 3207, 2918, 2523, 2048, 1538,
1045, 631, 359, 279, 422, 793, 1360, 2056, 2784, 3430, 3877, 4033, 3846, 3327,
2553, 1659, 823, 222, 1, 229, 874, 1801, 2795, 3606, 4020, 3914, 3302, 2345,
1313, 509, 181, 438, 1201, 2223, 3160, 3691, 3630, 3003, 2048, 1130, 603, 667,
2035, 1487, 1295, 1544, 2059, 2520, 2658, 2415, 1972, 1622, 1579, 1843, 2213, 2432,
2367, 2091, 1818, 1741, 1894, 2141, 2287, 2236, 2048, 1886, 1873, 2001, 2149, 2194,
2111, 1988, 1935, 1987, 2085, 2135, 2100, 2023, 1983, 2010, 2069, 2098, 2075, 2030,
2011, 2033, 2067, 2076, 2055, 2031, 2030, 2049, 2064, 2059, 2044, 2037, 2045, 2055,
2056, 2048, 2042, 2045, 2052, 2053, 2048, 2045, 2047, 2050, 2051, 2048, 2047, 2048,
2050, 2049, 2048, 2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048, 2048,
2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049,
2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048,
2049, 2049, 2048, 2048, 2049, 2049, 2048, 2048, 2049, 2049, 2048, 2049, 2049, 2048,
2048, 2049, 2049, 2048, 2048, 2049, 2048, 2048, 2049, 2049, 2048, 2049, 2049, 2048,
2048, 2049, 2048, 2048, 2049, 2049, 2048, 2049, 2049, 2048, 2048, 2049, 2048, 2048,
2049, 2048, 2048, 2049, 2049, 2048, 2049, 2049, 2048, 2048, 2049, 2049, 2049, 2048, 2048,};
// 下载波形
// 根据传入的参数选择数组
std::string param;
if (argc > 1) // 输入参数,控制下载波形
{
param = argv[1];
// 显示帮助信息
if (param == "-h")
{
std::cout << "Help information:\n";
std::cout << "Usage: \n";
std::cout << " main.exe [frequency]\n";
std::cout << "Where [frequency] can be:\n";
std::cout << " 1M - Generate 1MHz waveform\n";
std::cout << " 2M - Generate 2MHz waveform\n";
std::cout << " 500k - Generate 500kHz waveform\n";
std::cout << "If no argument provided, just check device status.\n";
}
else
{
if (param == "1M")
{
wave_point_num = 200;
downStatus = DDSDownload(device_index, buffer1M, wave_point_num);
printf(">>> Writing 1M-freq wave...\n");
}
else if (param == "2M")
{
wave_point_num = 100;
downStatus = DDSDownload(device_index, buffer2M, wave_point_num);
printf(">>> Writing 2M-freq wave...\n");
}
else if (param == "500k")
{
wave_point_num = 400;
downStatus = DDSDownload(device_index, buffer500k, wave_point_num);
printf(">>> Writing 500k-freq wave...\n");
}
else
{ // 默认情况为检查设备状态
printf("!!! Wrong arguments, please check !\n");
}
if (downStatus)
{
printf("Writing wave successfully!\n");
}
else
{
printf("Failed to write wave!\n");
return -1;
}
}
}
return 0;
}