From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Alarm sound output played when value from instrument exceeds threshold

We are trying to have a program produce an alarm noise whenever the value of the force read from a pressure sensor exceeds a certain threshold. We have a bridge setup going through USB to the computer. The program works fine and displays a force anywhere from 0-4 Newtons, depending on how much pressure is placed on the instrument. I tried wiring the numerical indicator into a case structure which has '3..', with a play waveform chunk inside the case structure. It seems that this works except that when it gets above the threshold, it doesn't stop playing. It gets stuck in the case and won't read any new values from the instrument. Its most likely a simple fix, I just don't have enough experience with labVIEW to know what the problem would be. Any help would be much appreciated!

0 Kudos
Message 1 of 9
(8,816 Views)

You are playing the waveform with the condition if VALUE = 3 then ALARM, but you need if VALUE >= 3 then ALARM.

 

 

Christian

0 Kudos
Message 2 of 9
(8,783 Views)

How do I denote VALUE >= 3 in the case structure? Isn't that the same as '3..'?

0 Kudos
Message 3 of 9
(8,769 Views)

Post your code. A picture is not much to work on 😉



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 9
(8,761 Views)

Yep, of course, I don't know why I didn't post it in the first place.

0 Kudos
Message 5 of 9
(8,744 Views)

You're unrealistically expecting that the value will drop back below 3 in the instant the event structure times out and checks for that condition.  If it happens at any other time (almost a certainty), the case structure switches to its default case where there is NO code.  That's why the the music keeps playing. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 6 of 9
(8,733 Views)

After looking in more detail at your code I'm seeing 3 embedded loops all with boolean switches to stop them.  Your logic seems a bit convoluted if you're trying to do what I think you are.  Why not change the audio part into a simple boolean indicator for now and see if you can get that switching correctly before you add the wave file alarm.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 7 of 9
(8,726 Views)

Okay, I played around with booleans and without the sound file and loop I can get the indicator to show "true" if over 3 and "false" otherwise. I guess the discrepancy comes with my misunderstanding of case structures. How do I get the sound to only play when true?

0 Kudos
Message 8 of 9
(8,715 Views)

I leave an example that can provide, use it in your program

Message 9 of 9
(8,239 Views)