LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

skip frequency / Frequenz überspringen

Hello,

 

There is a problem in my VI. If the upper limit (0.25) of the amplitude is reached, the button "Test starten" is pressed and it should continue to the next frequency. Manually it works, but if it should work automatically, a frequency is skipped.

 

Does somebody know how to solve this problem? I already have posted my problem in other forums, but nobody could help me. The program is attached. Ask for your help.

 

Best regards DOM

 

 

 

Hallo,


Ich hab da ein Problem in meinem VI. Wenn das Amplitudenmaximum von 0,25 erreicht ist, wird der Button "Test starten" gedrückt und es sollte zur nächsten Frequenz weitergeschalten werden. Manuell funktioniert das wunderbar, aber wenn es automatisch passiert, wird immer eine Frequenz übersprungen.

 
Weiß jemand warum das so ist und wie man das korrigieren kann? Hab das schon in anderen Foren gepostet, aber niemand konnte mir helfen. Das Programm befindet sich im Anhang.  Bitte um eure Hilfe.

 

Mfg DOM

Download All
0 Kudos
Message 1 of 13
(2,225 Views)

I didn't verify, but from looking at the code I think it's because you have 2 value signaling property nodes on "Test Starten". First you set it to True, then to False. This will trigger the value change event twice. Remove the second property node (setting the value to False). The value will be set to false in the event loop.

 

0 Kudos
Message 2 of 13
(2,218 Views)

Thanks for your help, but I already tried this solution once and now a second time and it doesn´t change the function of the program. Still one frequency is skipped.

 

Do you know another reason?

 

Best regards DOM

Download All
0 Kudos
Message 3 of 13
(2,194 Views)

Well, the code architecture does not seem the best for what you're trying to accomplish. Did you ever hear about a state machine?

Anyway, you're "Kanäle" array has 2 elements. Since the amplitude is increased both will have a value of 0.25 at some point. So the comparison " =0.25" will result in a TRUE for both elements and thus the event is triggered twice.

A simple fix would be to only trigger the event if the "i" (loop counter) of the for loop is 0.

As mentioned above, a different architecture would also help.

 

Message 4 of 13
(2,174 Views)

When I trigger the event if the loop counter is 0, the amplitude doesn´t increase, because at the beginning the loop counter is 0 and then the case structure is always true. This solutuion doesn´t work. But when i trigger the event when the loop counter is 4 (then the amplitude is 0.25) it also doesn´t work. I think, because the loop counter continues counting and isn´t resetted.

 

Do you know how I can solve this? 

 

Best regards

DOM

0 Kudos
Message 5 of 13
(2,170 Views)

I was talking about the counter of the for loop (the inner loop), not the counter of the while loop.

 

0 Kudos
Message 6 of 13
(2,162 Views)

I also mean the for loop. Okay, my statement that the counter doesn´t reset was an error by me.

 

I attached the program again with the changes you talked about. Is it right in this way? But how i said, the program doesn´t work. The amplitude doesn´t increase.

 

Best regards

DOM

Download All
0 Kudos
Message 7 of 13
(2,153 Views)

Now you deleted the condition amplitude = 0.25.

You should only trigger the Test Starten event when i=0 AND amplitude=0.25.

Again, a better code architecture would help significantly...

 

Message 8 of 13
(2,148 Views)

Thanks for your help. The program works now.

 

But now when it continues automatically to the next frequency, there is a sound, where no should be.

I searched, but i couldn´t find where it come from. Maybe you know?

 

Best regards

DOM

Download All
0 Kudos
Message 9 of 13
(2,143 Views)

Do you want to play a sound at amplitude 0.25 or not? The way it is implemented now the first sound at amplitude 0.25 will be quiet (amplitude is overwritten to 0), but the second sound will play.

If you want to play a sound at amp=0.25 then you don't need to set the amplitude to 0 in the case structure. If you don't want to play the sound then you need to set the amplitude to 0 also when i is not 0. But this doesn't seem to make a lot of sense.

 

Btw, you can give "Kudos" to a good answer. Just click on the + button next to the Kudos number.

 

0 Kudos
Message 10 of 13
(2,139 Views)