LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ho can I change a contraol variable value automaticly in an exact time

Hello

 

I am very new to LabVIEW. I would like to be able to change the vale of a global variable automatically in exact times. For example, I have a global variable that tells my DAC to set the resolution at a value (let say 3) and then after 3 min I need this value to change to 5 and then after 3 min to 0 and do on. The values are between 0-8. I appreciate if you have any idea to help me with that. Timing and being able to set the order of value is very important in my current VI. Thanks

0 Kudos
Message 1 of 4
(649 Views)

Hi Shhashemi,

 


@Shhashemi wrote:

change the vale of a global variable automatically in exact times.

For example, I have a global variable that tells my DAC to set the resolution at a value (let say 3) and then after 3 min I need this value to change to 5


Why do you need a global variable for that purpose?

How does your "DAC" recognize you have changed the global's value exactly after 3min?

 

Wouldn't it make more sense to send a command to your "DAC" at the required time to change a setting without using an additional global variable?

 


@Shhashemi wrote:

Timing and being able to set the order of value is very important in my current VI.


Use a FOR loop to index over an input array holding the time delays and setpoint values. Inside the loop you just need a wait function and a "set value" operation…

 

Hint: From your question it seems you should investigate in/learn about using state machines…

Best regards,
GerdW


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

You mean change something after a certain time interval not exact time...

 

Anyway in the timing pallet there are several items that can be used to wait for a certain amount of time.

 

tpUntitled.png 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 4
(597 Views)

Changing a global variable does not really do much. What matters more is what parts of your code depend on its value and when that part of the code decides to read that global variable.

 

To do a sequence of states, you don't need any global variable at all.

What kind of timing accuracy do you need (seconds? nanoseconds?).

 

Are all steps known before the experiment starts or do you want to be able to adjust timings and voltages on the fly?

 

How do you interact with your DAC hardware? What is your code architecture? (state machine? spaghetti? baby LabVIEW (i. e. all express VIs and dynamic data)?)

 


@Shhashemi wrote:

I am very new to LabVIEW. 


Have a look at the learning resources listed on the top of this forum.

0 Kudos
Message 4 of 4
(577 Views)