LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving data in USB coming from Queues

Solved!
Go to solution

Hallo Everyone,

I am getting data from FPGA to my Real-time system through DMA FIFO. I want to save this data in a USB. In real time system, I am using a Producer/consumer loop to get the data in a Queues. Before, I have saved data in USB through Shared Variables. As it is recommended, I want to save the data coming from the Queues. I have saved the data in following way- saving data is usb with shared variable.png

How can I save data coming from the Queues in this diagram? Or is there any other way to save the data is USB from Queues?

I want to save the data is CSV file format. And for every variable I want to put a column name.

I have attached my Real-time VI here.

Thank you everyone. Happy programming! Smiley Happy

0 Kudos
Message 1 of 6
(3,274 Views)

You're really asking a few questions here, and none of them are very detailed. We need to know what you've tried, and where it when wrong... All the gory details, the more the merrier. Ask general questions, you'll get general answers.

 


@Legolas-Elf wrote:

How can I save data coming from the Queues in this diagram?


The saving itself is exactly the same as your current solution. Just use a dequeue function to get the data. That data could be a cluster, so you need to unbundle.

 


@Legolas-Elf wrote:

 Or is there any other way to save the data is USB from Queues?


Other then what? You'll need to use File I/O functions, just like the shared variable solution.

 


@Legolas-Elf wrote:

I want to save the data is CSV file format. 


Again, that won't be different from the shared variable solution. If you have problems doing that, you need to tell those problems. As it is "I want to save the data is CSV file format" is a statement, not a question.

 


@Legolas-Elf wrote: 

And for every variable I want to put a column name.


Again, not a question. The shared variable solution seems to do this, the queue solution should not be too different.

0 Kudos
Message 2 of 6
(3,223 Views)

Hallo Wiebe@CARYA,

Thank you for your reply. Sorry for those confusing questions and for late reply. I try to clear up the questions below.

As you suggested, I used a dequeue function to get the data. I followed the process like this picture-

consumer loop.png

But in the indicator Fh3, Fn3, NgH3 and NgN3, I am getting the same value. It is the 1st value from the Indicator "Output Array". How can I correctly Unbundle the queues?

I also has attached the VI here.

Thank you for your time and help. Have a nice day.

0 Kudos
Message 3 of 6
(3,199 Views)

@Legolas-Elf wrote:
How can I correctly Unbundle the queues?

You don't.  Just use Index Array to get your values.  It is expandable after all.  Or to get what I think you are really after, use Decimate 1D Array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(3,193 Views)

Thank you for your suggestions.


@crossrulz wrote:


You don't.  Just use Index Array to get your values.  It is expandable after all.  Or to get what I think you are really after, use Decimate 1D Array. 

I tried to expand the Index array and also took the value from Decimate 1D Array. I get the value correectly. But in both case the program run for a few seconds and then stop. But if I use Unbundle by Name function the program run continuously without giving the right output.How can I get to run the program continuously using these 2 methods?

Here is the expending the index array method-

index array.pngUsing the Decimate 1D Array- decimate array.pngI attache the VI here.

Thank you.

0 Kudos
Message 5 of 6
(3,187 Views)
Solution
Accepted by topic author Legolas-Elf

Your choice to put elements in the queue is not that great. It's what's giving you problems.

 

Why don't you make the queue type a cluster of the 4 elements? Simply bundle them, put them on the queue, and on the dequeuer side you get the clusters back?

 

If you want to use the array, why would you convert to a 2D array? Why not convert the queue array to a cluster right after the dequeue? I don't see what the purpose of the reshape array is. Also, after the reshape the array will be 1X4, so the for loop is redundant.

Message 6 of 6
(3,173 Views)