LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to change control value outside while loop

Dear Community,

 

I am beginner on LabView, thus not common with Labview terms. I use DAQmx Tasks for Acquiring and Generating signal synchronously. But the problem isn't about a synchronization. The program is run well. While running, I can't change the value for writing task, since the bias panel is located outside the while loop. I understand this.

by still locating the bias panel outside while loop, I would like to change the value whenever I need. I was thinking to use a local variable (to call bias panel) and the event structure inside the while loop.

Does anyone here can give some advice/ suggestion? your help and advise, I really appreciated.

Here I posted the screenshot of the VI.

Thank you

 

0 Kudos
Message 1 of 9
(4,533 Views)

Start with a few basic tutorial and learn about dataflow.

 

Even if you would change the values of the "bias panel", it still would not make a difference unless the function connected to it runs again. Since it is outside the loop, it will run once at program start and never again.

 

 

0 Kudos
Message 2 of 9
(4,512 Views)

Dear Altenbach,

 

Thank you for your kindness to reply me.

Yes, i know well that it won't start again unless I stop and run again, since it is outside while loop.

That's why I posted here in a hope there is some suggestion.

However, I will start again with your advised, to learn about data flow. Thank you

0 Kudos
Message 3 of 9
(4,475 Views)

Make it all functions inside the while loop, except NI-DAQmx Create,Start & Stop Task and even NI-DAQmx Timing use it as a first call1st call.PNG method of inside the loop.

Message 4 of 9
(4,457 Views)

The bias voltage only needs to be set once and then whenever the value changes. No need for arrays. Also, if the user would change the rate, the lower train needs to be reconfigured.

 

What's the experiment?

Message 5 of 9
(4,444 Views)

Dear Sabari Saravanan,

 

Thank you for your suggestion. I have tried it and encountered an error.

I placed the every task inside the while loop, except Create, Start, and Stop Task, including Timing Task.

the error came from Timing Task or Start Task. Doesn't a Start Task (for Generating) should be placed after Write Task, while Start Task (for Reading) should be placed before Read Task? According to your suggestion with my limited understanding,I made an order

 Create -> Start -> Timing -> Write/Read -> Stop -> Clear

Am I wrong to understand your advice?

 

0 Kudos
Message 6 of 9
(4,429 Views)

Dear Altenbach,

 

Thank you for replying me.

The scheme is for basic experiment. By applying voltage that connected to load Resistance (resistor), I would like to measure the voltage, current, and resistance value. I want to be able change the bias voltage, sampling rate, and number of sample during the measurement.

The reason I placed everything outside the loop (except Read Task) is to get a synchronization between Write and Read Task. I referred to http://www.ni.com/tutorial/3615/en/

Previously, I have tried to put inside loop, but there are some errors.

Note: I used USB BNC 6229 and LabView 2018.

0 Kudos
Message 7 of 9
(4,427 Views)

The bias voltage is constant. A rate is irrelevant.

0 Kudos
Message 8 of 9
(4,415 Views)

Dear Altenbach,

 

Yes, I understand, based on the attached file in first post, the bias voltage is constant. I have no doubt.

However, i would like to change the bias voltage during the measurement.

What do you think I have to do in order to be able changing the bias voltage?

Or perhaps, do I misunderstand for what you said?

 

0 Kudos
Message 9 of 9
(4,411 Views)