Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Begin/End ReadMultiSample data in dimension 1 is not synchronized.

I am attempting to get to the bottom of why Begin/End ReadMultiSample does not synchronize the data within the readings of an AnalogMultiChannelReader?

Here is a simple way to replicate the problem I am experiencing using a NI-USB-6259:

 

1. Run a splitter so you can feed Analog Out 0 into both Analog In 0 and Analog In1.

2. Run your analog output voltage up to 5 volts.

3. Read the inputs with an AnalogMultiChannelReader using "Dev1\ai0,Dev1\ai1" (or Dev1\ai0:1).

4. Run your analog voltage down to 0 (zero) volts.

5. Read the same inputs.

6. n[0,0] will read 5 volts and n[0,1] will read 0 volts, utterly out of synch with each other.

In the next read, they will both be 0 volts.

The first entry in the data table is always offset by one (old) sample from the rest of the readings in the table.

 

What is going on here?  Is there any way to overcome this?

Is that fact that I am using a triggered acquisition causing this?

I am aware of an inherent clock delay on the analog reader, am I not using this correctly?, i.e.., Stream.ReadRelativeTo ?

I would like to simultaneously read Analog In 0 and Analog In 1 without Analog In 0 always being an old, unsynchronized value.

Do I need to do some fancy footwork to overcome this discrepancy?

 

I will whip up an example if this issue has not been discovered and/or resolved before.

 

Thanks,

Henry

 

0 Kudos
Message 1 of 4
(5,731 Views)

Are you using any synchronization methods to ensure that the two input channels are synched. Are you setting one channel to be a slave to the other channel? Just by simply reading the two channels doesn't inheritly synchronize them. I would look into the following link:

-Timing and Synchronization Features of NI-DAQmx

https://www.ni.com/en/support/documentation/supplemental/06/timing-and-synchronization-features-of-n...

 

This other link may also be helpful for you. I know that he discusses uses two devices but it is the same idea of having the slave task start before the master:

-Synchronizing DAQmx Devices in Measurement Studio With ai/StartTrigger Requires Slave Task To Be Explicitly Started First

http://digital.ni.com/public.nsf/allkb/D0D5605C84F15757862579030074CDA1 

dK
0 Kudos
Message 2 of 4
(5,706 Views)

Thanks Daniel.

 

Everything is wrapped in a single task, i.e..:

MyTask.AIChannels.CreateVoltageChannel

(
"Dev1/ai0,Dev1/ai1",
"Analog Multi",
(AITerminalConfiguration)(-1),
-10,
10,
AIVoltageUnits.Volts

);

 

I think the problem is based on the fact that I am attempting to perform simultaneous, triggered I/O.

I've attached a modified NI example which clearly shows the problem.

Run this sample with ao0 into a "T" splitter so you can monitor both ai0 and ai1.

When running the sample please note that "Input Data 2" is a real time measurement and "Input Data 1" is always a sample behind.

 

I've been experimenting with "ReferenceTrigger" rather than "StartTrigger" in my app.

I think this is showing promise when used with ReadRelativeTo.ReferenceTrigger.

Any insight on this feature and the inherent Trigger.Delay (>=2) would be helpful.

 

Thanks,

Henry

 

0 Kudos
Message 3 of 4
(5,701 Views)

I am curious, is this a continuation of the problem you were seeing in a previous forum post (http://forums.ni.com/t5/Measurement-Studio-for-NET/daqmx/m-p/2227256)?

 

I know that the SyncAIAO example is designed to specifically synchronize an input and output channels. Have you tried using any of the "Analog In" examples? I would look into "ContAcqVoltageSmpls_IntClkAnalogStart" and see if you experience the same delay in samples between channels.

 

Also, what you are using to trigger the acquisition (digital or analog signal, rising or falling edge, etc)?

dK
0 Kudos
Message 4 of 4
(5,658 Views)