我无法在 Python 3 上使用 nidaqxm 从 NI DAQ 获取连续数据。
我已经用类似的代码获取了有限的数据,尽管我不明白我需要改变什么来连续获取数据。
import nidaqmx
from nidaqmx import constants
from nidaqmx import stream_readers
from nidaqmx import stream_writers
import matplotlib.pyplot as plt
#user input Acquisition
Ch00_name = 'A00'
Sens_Ch00 = 100#sensibilidade em mV/g
Ch01_name = 'A01'
Sens_Ch01 = 100#sensibilidade em mV/g
fs_acq = 1651 #sample frequency
t_med = 2 #time to acquire data
with nidaqmx.Task() as task:
task.ai_channels.add_ai_accel_chan(physical_channel="cDAQ9191-1B7B393Mod1/ai0", name_to_assign_to_channel=Ch00_name,
sensitivity=Sens_Ch00, min_val=-5, max_val=5, current_excit_val=0.002)
task.ai_channels.add_ai_accel_chan(physical_channel="cDAQ9191-1B7B393Mod1/ai1", name_to_assign_to_channel=Ch01_name,
sensitivity=Sens_Ch01, min_val=-5, max_val=5, current_excit_val=0.002)
task.timing.cfg_samp_clk_timing(rate=fs_acq, sample_mode= constants.AcquisitionType.CONTINUOUS, samps_per_chan=(t_med * fs_acq),)
reader = stream_readers.AnalogMultiChannelReader(task.in_stream)
writer = stream_writers.AnalogMultiChannelWriter(task.out_stream)
我必须在代码中进行哪些更改才能获取连续数据?