Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

scxi 1600 Analog and Digital In

Hi,
 
I am using the SCXI 1600 USB DAQ Module with some Analog In (SCXI 1125 etc.) and one Digital In (SCXI 1162).
My task is to observe AI and DI. It is important for me, that the time lines for the AI and DI are in sync.
I thought the SCXI 1600 buffers the DI as well as the AI, but I was wrong: the 1600 buffers only AI and DI goes direct over the bus.
The Problem is now to assign the DI-Event to the corresponding analog cycles.
e.g.:
- 5 AI channels with 1kHz sampling rate (cont.): I read every 50ms 50 samples and take the mean =>rate is then 20Hz
- 1 line DI (the only working configuration is "on demand") I read the channel in the same loop, in which i acquire the AI's
At t=0 there is no data in the buffer of the SCXI1600
I get some load on the CPU, and the buffers is filling (t=load)
At t=event i get an change of the DI channel, but the corresponding AI value is older (t=load+x)
 
or not to technical:
I want to measure temperatures and the state of an valve (open/closed).
The temps are buffered and the valve state not.
 
How can I get these channels in sync?
 
thx
 
M.Tiedje
 
 
0 Kudos
Message 1 of 3
(2,945 Views)
Hello tiedjem,

I think I unserstand your problem. But let me put it into my words and see if I am right:

you are continuously acquiring analog data and reading the buffer in a loop - 50 values at each iteration. Which is timing the loop.
Because of some additional load you cannot garantee that the loop is executed every 50ms, which causes some samples to remain inside the buffer and therefore you are losing the synchronisation.

I would program in that way:
Use a wait function to time the loop to 50ms. And do not read a fixed number of samples out of the analog input buffer - read them all instead. This makes sure that no samples remain inside the buffer - thus you will not lose the synchronisation with your digital values.
Additionally I would collect a timestamp each iteration of the loop - since you are having a certain amount of jitter, a calculated timestamp (sample rate and number opf values) will not the truth.

regards

Ingo Schumacher
Systems Engineering Manager CEERNational Instruments Germany
0 Kudos
Message 2 of 3
(2,938 Views)
Thanks for your reply Ingo,
 
I think your suggestion will not work for me:
first I already use a while-loop with "Wait Until Next ms Multiple" with 40ms (a little bit faster as I produce data in the SCXI)
I have to read exactly 50 values, because I will average over these values. If I read as much as I can, I cannot be sure how much I will get (0 to 4096 is possible)
The timing (samplerate) to done in the SCXI outside the PC, so I think there can't be any jitter. The DI could have jitter because I only request the module "on demand"
 
What I like to do is: Tell the SCXI 1600 to put the DI in its buffer, that's all
 
The buffer of the SCXI is essential for DAQ, because this guarantees me not to lose data, iff the PC is bussy for some msec.
 
Does anyone have further suggestion?
 
thanks
 
M.Tiedje
0 Kudos
Message 3 of 3
(2,934 Views)