LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulating signal from event structure

Solved!
Go to solution

Hi everyone!

Is it possible to use the event structure to simulate/change different waveforms?

I've attached my VI.. when I push the button, the waveform changes, but it's locked.. I've already unchecked the "Lock Panel" option in the "Edit Events Handled by this Case" window, but it's still not working.

 

Help?

Thanks!

0 Kudos
Message 1 of 12
(4,261 Views)

The front panel isn't locked, it's just waiting for for an event. Because you don't have a timeout case configured in the event structure, it's going to block execution until you trigger another event.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 12
(4,233 Views)

I just tried adding an "Event Timeout" case, but the waveforms are still locked... I'm guessing I'm understanding you incorrectly.. (Sorry, I'm sort of new to LabVIEW)..

0 Kudos
Message 3 of 12
(4,189 Views)

Do you mean you want the waveform to move in time? If so, you're going to have a much easier time if you ditch the Express VI and use the "Basic Function Generator" function in the Waveform Generation palette.

 

One way to do what I think you want is as follows:

  • Unconditionally generate the next section of the waveform in your while loop, and have a timeout case (this doesn't need to do anything except pass the type of waveform from left to right, the waveform from left to right, and the phase from left to right)
  • Add a shift register to your while loop. Connect this to the type of signal input for the Basic Function Generator.
  • Use the Value Change events that you already have set up to change this value. One example is given below.
  •  Use defaults for the phase and the waveform when changing (unless you want to save history).
  • Append the waveform using Append Waveform (outside of the case)
  • If you do want to save history, ditch the waveform shift register, the append node, and just use a Chart.

I'm posting an image, rather than a snippet or VI, to allow you to recreate it yourself. This is unnecessarily difficult of me, since I already have a working VI, but I guess you don't mind since this is a learning opportunity 😉hint.png


GCentral
Message 4 of 12
(4,184 Views)

Hi cbutcher!

I guess it would've been helpful to explain what exactly I was trying to accomplish in my original post.. 🙂 

 

You know how a function generator has buttons to select which waveform a user wants to see (like the photo attached)? I'm trying to re-create something like that in LV.. where, I have a signal going, and if the user wants to switch from a sine wave to a square wave or sawtooth wave, they're able to do by pushing a corresponding button. In the VI that I attached, I'm able to switch the waveforms by clicking on a button, but the waveform isn't moving.. sort of like it's triggered, and I'm trying to un-trigger it. 

 

I hope I explained that well.. does that make sense?

0 Kudos
Message 5 of 12
(4,175 Views)

like this?

note, that this will only act on value change

select-waveform.png

(drag and drop on block diagram)


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 6 of 12
(4,168 Views)

for continuuous updating you should put the waveform generation inside the timeout case and read from the enum-control.

i guess you wouldnt even need a event-structure for that


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 7 of 12
(4,163 Views)

the standing wave comes from the how waveforms work (initial timestamp, delta t, and values)

and also, that you will generate same amount of samples which will then be displayed in the waveform graph (which doesn't keep a history).

try to replace the graph with a chart

select-waveform-2.png


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 8 of 12
(4,159 Views)

Heres the VI I mentioned earlier.


GCentral
0 Kudos
Message 9 of 12
(4,154 Views)

@cbutcher .. think you need to backsave to 2016


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 10 of 12
(4,152 Views)