01-31-2012 06:46 PM
Hello,
I am writing a VI in which an initial Voltage output signal (e.g. 10 cycles of a sin wave) is sent into an electronic device. At the same time, another channel reads the voltage. In the next iteration of a loop, I want the voltage signal recorded from the read to be written to the output of the original channel, such that input becomes output and so on.
Here is my vi at present, it works only in the most generous sense of the word, but I get a couple of errors that I cannot seem to fix.
Initially, the first iteration is recorded without a problem, but then in the read portion i get error -200279, then error -200462 in the write portion. These are tied to overwriting data in the input buffer, and an empty output buffer, respectively.
Attached is my .vi. Any words of advice or encouragement?
Thanks so much!
Solved! Go to Solution.
02-01-2012 06:19 PM
Hi gimNPC,
I have a couple of suggestions for your code to help eliminate those errors. First, you do not need the shift registers on the tasks that go through the while loop, you can remove these from both task lines. It will also be helpful to remove the DAQmx Stop and Wait before your DAQmx Write in the while loop. The stop should be done outside of the while loop. On the top task, your configuration should be set to continuous samples, not finite samples. Lastly, you should remove the DAQmx Sample Clock in the second task, this will cause problems between the two tasks. I hope this helps!!
Regards,
Kira T
02-01-2012 09:38 PM - edited 02-01-2012 09:40 PM
Hi Kira,
THanks very much for taking the time to help me on this.
I've applied the changes and attached my latest version. The VI runs with no errors (although a warning 200015); I cannot tell if it has worked because I get the cryptic "error -2525" (cannot convert specified file format or something like that) whenever I try to read or convert the tdms. Any ideas on what causes this?
I also have another important question: what is the reasoning behind all your changes? Through a process of trial and error I made version 1_0, and found that every part was necessary to get it to work. For example, I tried it without the daq wait/stop vis, but the initial output sign became badly truncated, possibly because the next loop iteration started before all the samples were read. The only problem seemed to be that a rather small portion of the initial output was truncated, so the result was a sort of sin wave with a chunk cut out. I'm just trying to get a better feel for labview, for when the documentation doesn't satisfy me!
Thank you,
gim
02-02-2012 06:35 PM
Hey,
Here is some of the reasoning behind the changes that I suggested you make:
For the TDMS error, I would suggest removing the DAQmx logging and do log your TDMS file as the program runs as part of your while loop. I have made some other modifications to the VI that I have attached below. Hope this helps!
02-02-2012 08:36 PM
The error code -2525 means the data type convertion failed, like when you storing the data values as string data type in the channel, but you require to read it as double values, the data type convertion would fail.
02-03-2012 02:27 PM
Okay thank you both Kira T and Yongqing Ye for helping me through this, and I think I have arrived at a solution that I wanted to post in case it helps other people with their projects.
Kira, I took your vi and, as suggested, exchanged the data logging for a manual .tdms data logging and that solved the problem of error 2525. However, when I looked at the data (see data1.jpg), there were 2 immediate problems:
The beginning of the initial sin wave was being clipped off. I attributed this to the fact that the first Daq write task begins before the read one inside the loop, so the first bits of the sin wave passed through the system before the read task could begin. I fixed this by placing the start task for the write vi inside the while loop, in a case statement that would only run on the initial iteration. Now the write and read tasks were synchronized.
The second problem is quite strange - it seems that only a portion of the data in iteration "i" is fed back into the write task for iteration i+1, and so the signal becomes progressively slowed down or magnified with each iteration since the write task writes a progressively smaller chunck of the initial sin wave. Through trial and error I found that by re-introducing the timing vi on the read task, this problem was solved.
In feedback v1_3. The desired effect is achieved: as the signal is fed back on itself the noise level increases steadily with each iteration,and there does not appear to be clipping or truncation of the sin wave.
Thank you both once again for your help!
-gim