10-19-2022 11:16 AM
Hello
I have a simple VI as follows:
There is an infinite outer loop; inside this loop, I have another (inner) loop, and I go out of this loop whenever a condition is satisfied. I define i as the loop counter when the condition of the inner loop is satisfied (then, it goes back to the outer loop and starts the inner loop once again). I want to run my program and save these i values as an array in a text file on my host computer. How should I do it?
I would be happy even if you could give me some keywords I can read.
Bests,
Majid
10-19-2022 11:18 AM
Hello Ben,
I have a simple VI as follows:
There is an infinite outer loop; inside this loop, I have another (inner) loop, and I go out of this loop whenever a condition is satisfied. I define i as the loop counter when the condition of the inner loop is satisfied (then, it goes back to the outer loop and starts the inner loop once again). I want to run my program and save these i values as an array in a text file on my host computer. How should I do it?
I would be happy even if you could give me some keywords I can read.
Bests,
Majid
10-19-2022 11:24 AM
@majid12
I would create a new post with your question, any code you've written so far and any specific errors you are running into so we can identify where the current issue is coming from. This post is over a year old and forum posts are meant to be one issue per post. Please create a fresh post and include the information above and the community can get back to you!
10-19-2022 03:06 PM
I'm confused. Am I responding to "Data saving from FPGA" or "Save loop counter in an array or a text file"? And how did @majid12 respond to Ben before Ben posted?
I'm going to assume that the data are originally in FPGA "memory", and need to (eventually) be written in some fashion to a Disk file on a Host PC. No mention of the "monkey in the middle" (unless you have a PC with integral FPGA chips, something I know nothing about).
Do you know how to take data that you generate (say, using a random number generator and some While and For loops) and save it to disk? [If not, learn enough LabVIEW to be able to do this task, as you'll need these skills for this problem].
Do you know how to take data generated by code running on an FPGA and get it passed up to the system "hosting" the FPGA Chip? [In my experience, this has been what NI calls a "Real-Time Target" machine, running an Real-Time OS and having special "timing" hardware to give better "determinism" than is possible on a Windows multi-threaded PC]. Again, if you don't know how to do this, learn.
Finally, where Real-TimeTargets are ideal for Real-Time tasks (where "determinism" is important), PCs are often better for managing Data Acquisition and Data Processing, such as saving the data to hard drives or to the Web. One generally communicates between Host (PC) and Target (which has the FPGA) using TCP/IP -- one fairly robust method that NI provides is called Network Streams, which I use and can recommend (noting that I have not tried using TCP or UDP protocols directly).
Without knowing more about the details of what you want to do, it is difficult to make more specific recommendations. If you have code that you are trying to write and need help with it, by all means attach your code (please don't just send pictures of parts of a block diagram!) and you will get a response.
Bob Schor
10-28-2022 03:10 PM
Hi Bob
Thanks for your reply. I have posted my complete question with the files here. https://forums.ni.com/t5/LabVIEW/How-to-save-data-as-a-text-file-in-labview-fpga/td-p/4262310 someone helped me. But my follow-up questions are still not answered. I would be happy if you could comment on my last question.
Moreover, Thanks for suggesting what I should learn. Can you also send some links where I can read about them? I could not find many resources for LabVIEW FPGA!
Bests,
Majid
10-28-2022 03:14 PM
Hi Ben
Thanks for your suggestion. I have created a new post with the files here https://forums.ni.com/t5/LabVIEW/How-to-save-data-as-a-text-file-in-labview-fpga/td-p/4262310. Someone helped me, but my follow-up questions are still not answered.
I would be happy if you could comment on my last question.
Sincerely,
Majid
10-29-2022 08:46 AM
@Majid12 wrote:
Thanks for suggesting what I should learn. Can you also send some links where I can read about them? I could not find many resources for LabVIEW FPGA!
Hello, Majid. I did the following:
Bob Schor
10-29-2022 10:10 AM
@Majid12 wrote:
Thanks for your reply. I have posted my complete question with the files here. https://forums.ni.com/t5/LabVIEW/How-to-save-data-as-a-text-file-in-labview-fpga/td-p/4262310 someone helped me. But my follow-up questions are still not answered. I would be happy if you could comment on my last question.
Hello, Majid.
I would be happy to "comment on your last question", but you must do two things for me:
I'll help if I can, but I won't comment on "pictures of block diagrams" (largely because it is a waste of my time if I can't see the details).
Bob Schor
11-08-2022 03:08 AM
Hi Bob,
Thanks for your reply.
1. Please find the compressed folder attached.
2. I want to save the loop counter in the last iteration. This value is written into a FIFO. I created a host VI to read FIFO. The question is:
a. I do not know how to save integer values in the host VI! I could only find the "Write to Text File" function, which only accepts strings.
b. I tried to use the "Write to Text File" function to save my data. I used the "Format into String" Function to convert each integer value into a string, but it made an error. (The error says: The type of the source is 1D array of unsigned long [32-bit integer (0 to 4,294,967,295)]. The type of the sink is unsigned long [32-bit integer (0 to 4,294,967,295)]. )
I have no idea how to do this. Unfortunately, I could not find an example of such things in the Labview tutorials or documentation. Sorry if I am asking a stupid question.
Kind regards,
Majid
11-08-2022 03:18 AM
Hi Majid,
@Majid12 wrote:
b. I tried to use the "Write to Text File" function to save my data. I used the "Format into String" Function to convert each integer value into a string, but it made an error. (The error says: The type of the source is 1D array of unsigned long [32-bit integer (0 to 4,294,967,295)]. The type of the sink is unsigned long [32-bit integer (0 to 4,294,967,295)]. )
I have no idea how to do this.
When you want to process each element of an array you could use an autoindexing FOR loop. This is very basic LabVIEW stuff, to be learned in Core1 training…