ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with initializing

Hi,

i have one While-loop (continouse acq. daq) and inside one case-loop (with 2 cases, true and false).

1. I always start with true-case. i need to set some value on a "set value" bar, and then calculate some output. it's working.
2. when i switch to false case, it should take the value of a "output", AND initialize the bar " set value" with this new number. but just for initalizing, after that i must have controll again over the "set value" bar.
3. from false to case the same thing -> taking the value of the output and initialzing the int bar.

p.s.: i need that for my dc-motor. in true case i set some frequency, and in false case i can set the power supply value. so, i need some switch from one to other case without starting from null frequency or power every time when i change the mode.

thanx in advance

vedran
0 Kudos
Message 1 of 3
(2,755 Views)
1... You VI neither uses EVENTS nor a WAIT function. Your loop ran 25 MILLION times in 10 seconds. You're hogging the CPU - put in a WAIT (100 mSec) so you don't do that.

2... You need to use LOCAL variables. They offer READ or WRITE access to a front panel object, no matter whether it's a CONTROL or an INDICATOR.

3... See the attached VI.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 3
(2,745 Views)
I would just use a shift register and write to a local variable of the slider whenever the switch changes state. (Since your calculation in the two cases is identical, it can be outside the case structure).
0 Kudos
Message 3 of 3
(2,739 Views)