Here is a minimal working version of the code I'm trying to run.
My aim is to run the ADC all the time to keep the samples current. When I do a read I would like 1 sample from each channel, but the latest samples.
Right now the samples remain the same all the time.
import nidaqmx
from nidaqmx.constants import AcquisitionType, VoltageUnits, READ_ALL_AVAILABLE, CurrentShuntResistorLocation, WAIT_INFINITELY
from nidaqmx.stream_readers import AnalogSingleChannelReader, AnalogMultiChannelReader
import numpy as np
CURR_IN_MODULE_0 = 'cDAQ1Mod2/ai0:15'
CURR_IN_MODULE_1 = 'cDAQ1Mod3/ai0:15'
sample_rate = 1000
num_of_read_channels = 32
num_of_samps_per_channel = 1
read_data = np.zeros(shape = (num_of_read_channels, num_of_samps_per_channel))
read_task = nidaqmx.Task()
read_task.ai_channels.add_ai_current_chan(physical_channel = CURR_IN_MODULE_0, shunt_resistor_loc = CurrentShuntResistorLocation.INTERNAL)
read_task.ai_channels.add_ai_current_chan(physical_channel = CURR_IN_MODULE_1, shunt_resistor_loc = CurrentShuntResistorLocation.INTERNAL)
read_task.timing.cfg_samp_clk_timing(rate = sample_rate, sample_mode = AcquisitionType.CONTINUOUS)
reader = AnalogMultiChannelReader(read_task.in_stream)
read_task.start()
while(1):
reader.read_many_sample(data = read_data, number_of_samples_per_channel = num_of_samps_per_channel)
print(read_data)