LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two sub vi s simaltaneously needs data from a queue

Hi, 

    I have one queue and need to execute the following:

(a)    One vi displays data from the queue by using dequeue function.

(b)    Another vi parallely needs to save this data in a text file from the queue.

These two vi s are called as subvi s.

When (a)  executes,that data will not be available in the queue and so  (b) cannot save that data in a textfile since it is not available in the queue.

 

Please give the solution

 

 

0 Kudos
Message 1 of 7
(2,208 Views)

You can enqueue the data again after (a) executes so that it will not be lost.

Im thinking of something like this:
(1) Enqueue data.

(2) Dequeue your data on the vi displaying your data.

(3) Re-enqueue your data on that same display vi.

(4) Dequeue the data on the vi that logs the data

0 Kudos
Message 2 of 7
(2,204 Views)

Hi,

 

to expand clnglenn's suggestion: You should use a different queue for step 3&4…

 

Btw. I would do the data saving part first, before displaying the data on the UI.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(2,172 Views)

You can simply put the same data into two queues.

One for display, one for logging.

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 7
(2,168 Views)

I will give you two options.

1. Use a separate queue for each function.

2. Use User Events.  In this case, each subVI would use an Event Structure and register for the User Event.  But both would get all of the data.

 

Since you are already half way there, I would go with #1.


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 5 of 7
(2,149 Views)

I suggest using a Channel Writer (Event Messenger type).

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 7
(2,130 Views)

Why not save and display the data in one sub-vi?

 

Without seeing your code it seems silly to add a whole 'nother queue for this.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 7
(2,101 Views)