LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multithread Loop in one VI

                  Hi,
 
I'am french user using Labview 8.1, and I have trouble using Loop While and Event structure in my VI. In the VI join to this post, you can see that if I turn ON the output program, the discrete input reading is stopped. How can I do to read discrete input, and to run output program in the same time, in the same VI, and with differrent sampling frequence.
0 Kudos
Message 1 of 6
(3,083 Views)

Hi SebBourgeois,

to do this you have to use two "real" parallel loops. I´m not sure which is the "write" part in your vi, but your event structure can only run if the other loop is ready.

Mike



Message Edited by MikeS81 on 04-22-2008 09:44 AM
0 Kudos
Message 2 of 6
(3,082 Views)
Thanks, it work.
 
I join the modified VI
0 Kudos
Message 3 of 6
(3,077 Views)
Taking a look into your approach, you should definetly take a look into the design patterns delivered with LV. I would recommend taking a close look into Master/Slave, Producer/Consumer(Data) and Producer/Consumer(Events).
You can find those patterns in the template browser (File>>New).

Using the best fitting template, you can remove as far as i have seen ALL VARIABLES and the sequence structure. This will improve your code in a great way. On the other hand, i am sure that those patterns include the answer you are looking for!

hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 6
(3,064 Views)

I'am sure you're right, but my Labview experience is poor, and I don't understand how to use this template for my application.

I thinks the template I need is Events Producer/Consumer, but I don't know how. And How can I dissociate the input reading periode from the output program timer in this case ?

0 Kudos
Message 5 of 6
(3,056 Views)
Both loops are timed by events, in another word: asynchronuous.
The producer, as the name implies, should act as input whereas the consumer retrieves the data and processes it. So you need dataflow from the producer to the consumer. This is solved by the queue.
The producer/consumer works very nice if you can make sure that the consumer is working faster than the producer; if not, you have to split the consumer up into several more consumers, making the architecture more complex.
Please take a close look into the template and execute it several times; watch the execution using highlight mode to get the idea "what happens where and when". I think you will understand the basics of the template quite fast and then you can begin to adapt it to your needs.

hope this helps,
Norbert


Message Edited by Norbert B on 04-22-2008 04:04 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 6
(3,050 Views)