I'm using a NI USB 6211 board and I need to read two signals (two sawtooth of different period) and regenerate them with same amplitude and frequency but delayed.
What I'm doing is reading a bunch of samples (let's say n samples), unbundle the waveform signal (in Y, dt, t), remove the last k samples of the sequence Y and insert in the begining of the array sample Y the last k samples of the previous sequence (I'm using a shift register in a while loop). In this way the signal is delayed by the k samples that I take from the "tail" of the array and reattach in the "head" of the next array. The newly build signal is converted into waveform and generated by the board.
If I use a graph to see the result the waveform is perfecly equal to the input one and delayed of k samples.
The problem is that if I use an oscilloscope to check the input and the output signal of the NI board the generated signal doesn't move in time, it has a delay but I cannot control it while in the graph the signal change accordingly with the number of shifted signal that I choose.
A curious fact, that I noticed by mistake, is that if I change the index of the array Y, where to insert the k samples for the delay, from 0 (at the begining) to n-k, the generated signal is obviuosly destorted if I change k the signal changes delay in real time, as i want.
Does anyone understand where is the problem?
(the attachment is the VI for just one signal, not two but I think it doesn't makes a big difference)
if i understand the problem you're trying to syncronize input and output from a DAQ interface in order to create a loop.
It could be a tricky problem because what you see into the waveform graph is quite different from what you see as output of the DAQ
Infact you have to consider the on board memory of the DAQ device that makes non deterministic the tailing of data from PC to DAQ and viceversa.
Moreover controlling timing and triggering could also be not possible using Express VI so I suggest you to take a look at the following links on DAQ functioning and see the tutorial on DAQmx programming.