From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

execute case structure only once

Hi everybody.

 

I want to execute a case structure inside a while loop only once. The case strucutre is controlled by a counter, so that every time the counter has a value multiple of N, the program records an acoustic signal and calculate the main peaks of the FFT. The problem I have at the moment is that, every time the case is executed, it records and analyze the sound several times until the counter jumps to the next value. I want the case to execute only once every time the counter has a value multiple of N. I atttach the vi.

 

Thank you for your attention guys!!!

 

Pulsations.JPG

 

 

 

0 Kudos
Message 1 of 13
(4,540 Views)

Hi Franky,

 

right now the case structure is called with

IF counter = zero

 

You should change that to

IF (counter = zero AND counter <> previous counter value)

 

Btw.  there are special functions to compare for "=0". There is also a function to convert a boolean to 0/1.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 13
(4,528 Views)

GERD is right.  You should use a feedback node to store the previous count value.  If the current count is Not Equal AND the remainder is Equal To Zero run your case.

 

Since your counts are all integers, I would also recommend changing the representation to an integer type.  I32 would likely be the most appropriate.


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
Message 3 of 13
(4,520 Views)

Already solved! Thank you guys!!

0 Kudos
Message 4 of 13
(4,501 Views)

Hey, I'm new to Labview. Im facing the same problem.Please can you show me how to do what you have suggested?

0 Kudos
Message 5 of 13
(3,702 Views)

Hi amysri,

 

I'm new to Labview.

Yes, you even don't know how to spell/write "LabVIEW"… 😄

Did you notice that "beginner" (aka "Tutorials") section in the header of the LabVIEW board?

 

Im facing the same problem.Please can you show me how to do what you have suggested?

This forum works the other way around!

Show us what you have tried so far and tell us, where you are stuck!

 

As has been said several years ago: you will need two comparison functions and a shift register (or feedback node) to reach your goal!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(3,693 Views)

@amysri wrote:

Please can you show me how to do what you have suggested?


 


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 7 of 13
(3,679 Views)

Hi crossrulz

Thank you so much.. 🙂

It means a lot

0 Kudos
Message 8 of 13
(3,675 Views)

@amysri wrote:

Thank you so much.. 🙂

It means a lot


Funny, I don't see any "thank yous".

 


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
Message 9 of 13
(3,668 Views)

My first post begins with an apology...to crossrulz for incorrect posting etiquette and probably a ton of other forum transgressions, but a POST button is missing for some reason and I have been researching and fiddling around for days on how to execute a case structure only once.  I finished Core 1, working on Core 2, but am still practicing on actual coding, so would appreciate really dumbed-down help. 

 

Specifically, how can each of the case structures in the attached pic be programmed to execute once?  Others have suggested local variables, "implies statements", First Call?, Shift Registers, but am not sure how to implement them

 

Thanks for any direction.

 

 

 

0 Kudos
Message 10 of 13
(3,412 Views)