07-27-2009 03:59 PM
I'm new to LabView and I was looking around the forum trying to find a solution to a problem I have. I'd like to be able to have a Trigger that detects a threshold that I can change on the fly. Right now my program has a set amplitude that it triggers on, but I'd like to be able to drop in a slider and change the threshold as I go. A bonus would be to have the threshold value be displayed on the graph I'm using, but it's not necessary.
http://forums.ni.com/ni/board/message?board.id=170&message.id=283779
The above post is pretty much what I need, but I didn't recognize most of the controls being used, and there was no source file to look at. Is there any way to change the threshold on the fly without having to mess with arrays like in the above example? If not, could someone please explain the process to me.
Solved! Go to Solution.
07-27-2009 07:13 PM
If you can post the code you have so far, it would help. Also, please let us know what hardware you are using.
It sounds like you need (at least) an event structure inside a while loop. At least one of the events you would need to define would be where you change the trigger level -- and that would send the appropriate command to your instrument.
07-27-2009 11:05 PM
07-28-2009 01:41 PM
Hi rmhughes,
Have you looked at this example here? It mostly uses Express VI's (there doesn't seem to exist an example yet that uses the lower level VI's).
07-28-2009 01:53 PM - edited 07-28-2009 01:58 PM
07-29-2009 02:32 PM
Hi rmhughes,
The Trigger and Gate VI is an express VI and the threshold property cannot be configured programmatically. Is there a particular reason you have to use this VI? If you are looking for a certain number of signals before or after the trigger, you can use arrays to achieve a similar purpose.
I've attached the source code of something similar to the linked forum post from above. Basically all it does is generate a sine wave and the threshold line and plots them both on the same graph. No comparisons are done. The stuff with getting the waveform components and using arrays is to create the threshold line for the graph.
07-29-2009 03:25 PM
Hi Olivia,
The project I am working on looks at the amplitude of a sound and upon sensing an amplitude of a certain amount for a specified amount of time, it plays a sound back. I was initially drawn to the 'Trigger and Gate' VI because it allowed me to easily configure an amplitude on which I could trigger. The problem came once the project was run in a real environment and it was realized that the amplitude won't always be that set number and will need to be changed frequently during an experiment.
The file you have attached will help greatly! I still have two questions though. How can I apply something like a DAQ Assistant to that model so that I can have real time data? And is there a way to have that model spit out a True/False like the 'Gate and Trigger' VI does?
07-30-2009 12:01 PM
08-05-2009 12:34 PM - edited 08-05-2009 12:35 PM
08-06-2009 04:49 PM