LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving trigger like on-off mechanism

Hi all,

 

           I have to recieve (read) trigger from other PC and as soon as I recieve the trigger further array calculations and opearations will be perfrormed. The trigger will come from the PC like on-off (means it will trigger then goes off). Just suppose the button here as a trigger recieved from PC. Now the problem is how can I use case structure for this purpose? If I can't use case structre then what are the other options? Because I want to perform array operation whenever I recieve this trigger then trigger goes off, after sometime it agains trigger and again the same process of array opeartions.

 

Hope I described clearly. 

 

Regards,

 

Amna

 

0 Kudos
Message 1 of 4
(2,436 Views)

I loke the OpenG Boolean Trigger vi for this.

 

Example_VI_BD.png

 

but, this looks promising.

 

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 4
(2,410 Views)

LabVIEW has a number of features that will enable you to do exactly what you describe.  One is the Event Structure -- this is something that just sits around, not using any CPU time, until "something interesting" happens, such as a Control changes, or a key is pressed, or the programmer just "raises a User Event flag".  This runs inside a While "Do-Forever" loop, but as noted above, it simply waits until one or more of the Events you have designated fires.

 

The other piece of the puzzle is something called the Consumer/Producer Design.  This consists of two While loops, running in parallel.  One, the Producer, is the Event loop described above -- it sits idle until an Event happens, then "produces" a signal that is sent to the other, Consumer loop.  One way to convey information from Producer to Consumer is via a Queue, a data structure that lets you put data in one end and have it come out the other.  The nice thing about Queues is that they also have a "blocking" function -- if there is nothing in the Queue (because no Event has fired), then the Consumer loop trying to process the next element in the Queue will simply wait, again taking no CPU time.

 

What all of this means is that you can have a third loop doing something that needs to be constantly updated (like maybe updating a display) while the Consumer and Producer "talk to each other" in the background, only requesting computing cycles when (a) a Event occurs (Producer) or (b) there is something new to process (Consumer).

 

I realize this may be a slight overkill, but it really illustrates the power of LabVIEW -- the ability to do two or three things in parallel, the natural way "time" is allocated among processes, and the flexibility of the possible designs.  To learn more, you should be able to Find Examples, particularly if you look for Consumer/Producer (or maybe Producer/Consumer) and Event Structure.

 

BS

0 Kudos
Message 3 of 4
(2,386 Views)

It's probably better to use an event structure as mentioned, but if you did want to keep it to a single loop I have this example which shows how you could trigger a timed process using a latch button and a case strucutre (just in case it's of interest to anyone)Trigger Mech Example.png

CaseStructureFalse_Example.png

0 Kudos
Message 4 of 4
(2,352 Views)