LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

One button with 3 or more cases

So we were asked to reproduce the function generator and oscilloscope as a virtual instrument for our final exam. But I'd like to focus on the function generator. The audio generator GW Instek GAG-809/810 has only a single button for the waveform wherein the user would just press it repeatedly to show the desired waveform (i.e., sine wave, square wave). Yeap, the audio generator only have the two waveform but our professor wanted us to add the generator's feature, that is, for the users to be able to display the wave into sawtooth and triangle wave.

 

So how do we construct it, that different wave forms would display everytime we press the button?

0 Kudos
Message 1 of 19
(2,773 Views)

Hi geneclaude,

 

you could start using an Enum control when it comes just for the functionality.

 

Otherwise you may use a boolean button, check for rising edges (or use value change events) to count up an additional enum holding the waveform mode…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 19
(2,767 Views)

You need to use the Boolean as a toggle that will step to a different waveform each time it's pressed.

Something like this:

 

Toggle Waveforms.png

 

Of course, this is an example that needs a lot of work.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 3 of 19
(2,743 Views)

Nice Kelly

 

Don't forget to type def that enum!


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 19
(2,729 Views)

Don't forget to type def that enum!

Yeah, I meant it when I said it needs work.  The enum needs to be a type def and this really should feed a producer/consumer or something like that.  I just threw that togeather to give the OP a starting point.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 5 of 19
(2,724 Views)

i was thinking.....

sine.png

Message 6 of 19
(2,716 Views)

That works, too, except there are four waveform types not three (Sine, Square, Triangle, Sawtooh) so the constant should be a 3 instead of a 2.  The concept is very good.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 7 of 19
(2,706 Views)

@kbbersch wrote:

That works, too, except there are four waveform types not three (Sine, Square, Triangle, Sawtooh) so the constant should be a 3 instead of a 2.  The concept is very good.


you got the jist of it....   Smiley Wink

 

actually, 4 waveforms (0,1,2,3)...constant should be 4

Message 8 of 19
(2,703 Views)

@apok wrote:

@kbbersch wrote:

That works, too, except there are four waveform types not three (Sine, Square, Triangle, Sawtooh) so the constant should be a 3 instead of a 2.  The concept is very good.


you got the jist of it....   Smiley Wink

 

actually, 4 waveforms (0,1,2,3)...constant should be 4


Guys... Ahem ... Constant?  P-Node Num.ElementsSmiley Wink

 

Go to it !


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 19
(2,682 Views)

apok wrote:

 

actually, 4 waveforms (0,1,2,3)...constant should be 4


Constant should be the highest number we expect to see, which is 3 or number of elements -1, since the first element is value 0.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 10 of 19
(2,677 Views)