LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating a Value in a VI

Hi there,

 

I have a question concerning the uptdate of some values in a running VI.

 

Basically I am sending the combination of two waveforms to the DAQ board that controls a mechanical system and then I'm reading the values acquired by the DAQ board that records the response of this same system.

The signal is acquired thanks to a while loop so that it continues to acquire if I don't press the stop button on the front panel.

 

My question is:

 

I would like to dynamically be able to change certain parameters of those two wavefroms like frequency amplitude and offset. However for now as those waveform generation are not embedded in the while loop, I can't change those parameters dynamically... (And I would like to be able to change them in the front panel.)

Is there an easy way around this problem?

 

 

Many thanks,

Best,

Renaud,

 

Ps: I attached the block diagramm of this specific VI 

Download All
0 Kudos
Message 1 of 5
(2,658 Views)

I think it is not possible to change the waveform generation type on the AO channel dynamically, after you started the task.

 

However, you can make a simple state machine, so when you want to change the waveform type, your state machine moves to the "Stop DAQmx" state, after that moves to the "Setup DAQmx waveform" state, and finally your task is again running after a "start DAQmx AO" state.

 

Of course this will give a little delay in your system, since stopping the AO task, and restarting it with the new waveform takes some time. If it is OK for you, go for a state machine (there are templates in LV).

If you need a smoother transient between the generation of the two waveforms (much faster), I think it is possible if you use two channels for AO as mentioned here:

http://forums.ni.com/t5/LabVIEW/change-sample-output-rate-of-daqmx-PCI-6733-card-in-mid/m-p/1744436/...

 

 

0 Kudos
Message 2 of 5
(2,643 Views)

You need to move the analog write, and all the controls defining your waveform, into your while loop. Right now the output is continually writing the waveform that you initialize it with.

 

Edit: Look at this example -- <LabVIEW>\examples\DAQmx\Analog Output\Voltage (non-regeneration) - Continuous Output.vi

0 Kudos
Message 3 of 5
(2,614 Views)

@GregFreeman wrote:

You need to move the analog write, and all the controls defining your waveform, into your while loop. Right now the output is continually writing the waveform that you initialize it with.

 

Edit: Look at this example -- <LabVIEW>\examples\DAQmx\Analog Output\Voltage (non-regeneration) - Continuous Output.vi


My mistake, you are right, if the poster only wants to change the waveforms, this method works. I thought changing the AO/AI  rate is also requirement, but the poster did not mention it, so I guess it is constant.

0 Kudos
Message 4 of 5
(2,604 Views)

thanks for your promp reponses!!!

 

I just put the waveformes into the while loop and it works 🙂

 

One additional question though:

 

The signal that I am sending and the signal that I am acquiring are not in phase and it seems that the phase of the waveforms is changing according to the frequency of the waveforms....

 

Do you have any idea on how to fix this problem?

 

many thanks,

Renaud

0 Kudos
Message 5 of 5
(2,561 Views)