02-16-2007 10:35 AM
02-16-2007 01:29 PM
02-16-2007 01:48 PM
Thanks a lot for your reply Dennis.
In fact, I am sorry 'cause to simplify things I have not included a while-loop which surround all the vi, so I repeat the read a certain number of iterations chosen by a control.
In fact, in the chart the three signals look ok.
The for/loop is the best way I've found to make a readout in the pannel control by a three component array of the real-time values of the signal for each channel, with that loop I write the values read by DAQmx continuously. That also works fine...
So, how should I proceed to get the right dt? I am sorry if you already told me and I have misunderstood you, I am quite new in these business.
Thanks!
02-16-2007 02:02 PM
You have to add a DAQmx timing function to select a sample rate and actually get more than one sample at each DAQmx Read. If you leave it in single sample mode, you would write you own value to the dt based on how fast your loop iterates.
I understand the chart looks correct, what I was asking was whether you got just a single sample written to the chart with each iteration.
02-16-2007 02:16 PM
Thanks a lot, sorry for my mistake.
I will try with the timing function (I am not in the lab now).
The thing is that before I was working in single mode in the Read vi and with a timing while-loop of 1 ms, and dt it was equal to 0 as well. Is that normal? I was expecting, as you said, that dt was more or less equal to the while-loop wait constant. I think that could be a problem for the power spectrum vi if, though I included a sample rate using timing functions, once it goes to the next iteration it writes a dt=0.
But, don't worry, I should try before anticipating what will happen and in last term I will bother you all again with this.
Thanks!
02-16-2007 02:52 PM - edited 02-16-2007 02:52 PM
I'll try to explain a little better. In single point mode, you only have a single element in the y array of the waveform data type. With a single element, dt doesn't apply (you can't have a time between samples if you only have one sample) and the DAQmx driver writes a zero to dt. You can however, modify the dt after you've acquired the data. You can convert the loop rate in msec and write it to a waveform. Maybe the attachment will make it a bit clearer. There's a while loop that is doing single point acquisition. Each channel is indexed and then each y array is indexed to get the single value. I only show the steps for one channel but the while loop auto-indexes the single value out into an array when the while loop completes. You then have an array of all acquired values. To pass it to another function that requires a waveform data type, you use the build waveform function to specify the dt.
Please be aware that if you stick with single point acquisition, the dt is not very accurate. The timing is based on windows running your loop at some interval and that interval can change dramatically , depending on what windows decides to do. You may have a 1 msec wait in there but it could up to a couple orders of magnitude in actual wait time. That is why you never want to do software timed acquistion for such things as an FFT. Your results are going to be pretty meaningless unless you move to a real-time OS.
Message Edited by Dennis Knutson on 02-16-2007 01:52 PM