01-23-2007 12:35 PM
Hi Sal,
In my application, it is acceptable to get certain time lag of about 10-20ms due to Task start/stop inside the loop. Therefore I am looking for some simpler solution without triggering.
Fragment of my code looks like following:
meas_channels_task(0) = New Task
meas_channels_task(0).AIChannels.CreateVoltageChannel("cDAQ1Mod8/ai0:15", "", AITerminalConfiguration.Rse, -10.0, 10.0, AIVoltageUnits.Volts)
meas_channels_task(0).Timing.ConfigureSampleClock("", 3000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples,2)
read_task(0) = New AnalogMultiChannelReader(meas_channels_task(0).Stream)
For i = 0 To 15
‘--- pulse generation---
‘. . .
‘-----------------------
‘--- Data read---
meas_channels_task(0).Start()
data = read_task(0).ReadMultiSample(num_of_samples)
meas_channels_task(0).Stop()
Next
When I move meas_channels_task(0).Start() and meas_channels_task(0).Stop() out of loop, and increase last argument in Task.Timing from 2 to 32, I don’t get any error message but obtained data are not correct. It looks like I receive measurement results from the first iteration stored in the buffer.
Is there certain possibility to ensure repeatable reading inside loop with refreshing (clearing) the buffer?
Thank you,
Oleg.
01-24-2007 09:29 PM
Hello. As Sal said, to get new data from the finite task, you will need to stop and then start the task again. In order to remove the possibility that you will read data acquired on the first iteration in subsequent iterations, you will need to stop and start the task again or use some type of retriggerable analog input acquisition.
Brian F
Applications Engineer
National Instruments