12-07-2010 03:26 PM
We have developed an instrument control and data acquisition system for a mass spectrometer using LabVIEW FPGA. Currently we have 6 counters on the FPGA, counting for 1 second intervals and transferring data to the host using a FIFO.
The data, as a local variable, is used in several different parallel loops on the host. One of these is coded to write the data to a text file. Unfortunately everything we have tried has failed. It is proving impossible using either the write to file VI provided with labVIEW, or to use the Open file, write and close file utilities. Each attempt has failed. Yet when running a dummy code we can write to files. The dummy code consists of 6 random number generators running in one loop and the write to file VI in a second loop. The random numbers are transferred across the loops as local variables.
Can anyone offer any advice as to what we might be doing wrong. We're beginning to feel as though we are banging our heads against a brick wall and getting very frustrated.
Many thanks in advance for any suggestions.
12-07-2010 03:50 PM - edited 12-07-2010 03:51 PM
Hi Paul,
you neither say, what is failing nor do you show any code... How should we help then?
"impossible using ... the write to file VI"
Well, usually they work just fine.
"Each attempt has failed."
In which way? Error number given? Did you use the debuging tools, like probing, breakpoints and highlighting?
"as local variables."
It seems you're not properly do program "real" LabVIEW code
12-07-2010 04:36 PM
Gerd, I'm writing this from home and don't have a copy of the code with me to post, or a copy of the error codes and messages. I'll post these tomorrow.
Maybe my understanding of the relationship between the FPGA and the HOST is incorrect. We can transfer the data to the host. On the host we both manipulate, display the integrated counts and plot the data on charts and graphs without any problems. The only issue is when we try to write this data to a .txt file. From memory the error relates to inability to create, or open a file. Of course it may be a simple problem of incorrectly specifying the path etc. but I don't think so!
Anyway, I'll post the code tomorrow and hope you might be able to give some advice.
12-09-2010 05:32 AM
Attached is a simple piece of code that runs fine on my laptop, but when I embed it in the Host vi. does not write to a data file. I get no errors when it runs but the file is empty?
12-13-2010 05:07 AM
Hi Paul
Really simple error this one, all we will need to do is alter the "operation" terminal of the Open/Create/Replace File.VI. Currently with a "0" wired in, the VI can only open an existing file. If we change this to "4" it will allow the VI to replace or create.
Attached is a screen shot that highlights this.
Top Tip: press "ctrl" + "H" to view the context help. I use it all the time as it highlights the VI you are currently hovering over and discusses its terminals inputs and outputs.
Hope this helps, Still got some issues? Be sure to post back!
Regards
12-13-2010 05:09 AM
The attachment!
12-13-2010 11:10 AM
Richard, many thanks for the suggestion. I have already tried this and still I get no joy. Is the issue that I'm implementing this code on the host side of an fpga project?
Really, this should not be so difficult but is proving to be a great frustration.
12-13-2010 11:54 AM
In general, you're doing fine with fetching data from the FPGA via some host VI(s) and streaming them to a file.
Just a few hints:
You can right-click on any terminal of the File-IO (and any other) Sub-Vis and select "create->constant". Now, an enum constant with the specific meaning is created for this input.
Why don't you use the [i] terminal of the while-loop (or a for-loop) to control the number of iterations?
regards