Sub vi connectior

Post beginners questions here. Don't be ashamed starting stupid topics.
Ответить
Bombbooo
beginner
beginner
Сообщения: 27
Зарегистрирован: 19 мар 2012, 16:03
Версия LabVIEW: 2010
Контактная информация:

Sub vi connectior

Сообщение Bombbooo »

Hello again. now I got a problem with connecting a sub vi to the main vi. As you can see in my vi, I connected "unit conversion" to my main vi but it didn't work like I tested in my sub vi. I'm not pretty sure about input/output connector in the sub vi. There are some local variable I cannot set as an output.

My objective of this sub vi is to make the values change correctly along with the changed units before going to the saving program. But after I connected it, it didn't work.
Вложения
Values Measurement 1-main(2).vi
(28.1 КБ) 267 скачиваний
Аватара пользователя
mzu2006

Professionalism Tutorials Black
doctor
doctor
Сообщения: 2456
Зарегистрирован: 16 авг 2008, 02:12
Награды: 3
Версия LabVIEW: 7.1 10 11 12
Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
Контактная информация:

Re: Sub vi connectior

Сообщение mzu2006 »

post the subVI, please
Bombbooo
beginner
beginner
Сообщения: 27
Зарегистрирован: 19 мар 2012, 16:03
Версия LabVIEW: 2010
Контактная информация:

Re: Sub vi connectior

Сообщение Bombbooo »

I already connected the sub VI "unit conversion" in my main VI but the values in the data mainstream didn't change like in the subVI
Вложения
unit conversion-1.vi
(21.58 КБ) 246 скачиваний
selecting data to save.vi
(30.41 КБ) 254 скачивания
selecting data to plot.vi
(30.39 КБ) 252 скачивания
Аватара пользователя
mzu2006

Professionalism Tutorials Black
doctor
doctor
Сообщения: 2456
Зарегистрирован: 16 авг 2008, 02:12
Награды: 3
Версия LabVIEW: 7.1 10 11 12
Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
Контактная информация:

Re: Sub vi connectior

Сообщение mzu2006 »

You have an event structure in the subVI. It does not react to programmatic change of values in the main VI unless you specifically instruct it to do so (via VI Server and dynamic event registration). I advice to move the event structure out to the main VI.
Bombbooo
beginner
beginner
Сообщения: 27
Зарегистрирован: 19 мар 2012, 16:03
Версия LabVIEW: 2010
Контактная информация:

Re: Sub vi connectior

Сообщение Bombbooo »

I move it out but it didn't work in the way I want. I want the user to be able to adjust both units before the data flows in the big while loop.
Вложения
Values Measurement 1-main(2).vi
(37.42 КБ) 250 скачиваний
Аватара пользователя
mzu2006

Professionalism Tutorials Black
doctor
doctor
Сообщения: 2456
Зарегистрирован: 16 авг 2008, 02:12
Награды: 3
Версия LabVIEW: 7.1 10 11 12
Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
Контактная информация:

Re: Sub vi connectior

Сообщение mzu2006 »

The event structure in the while loop should work before the data goes to the processing loop.
You should change tunnels for shift registers (RMB-> chnage to shift registers).
You may also want to move variable update inside the while loop to make the changes visible?
Bombbooo
beginner
beginner
Сообщения: 27
Зарегистрирован: 19 мар 2012, 16:03
Версия LabVIEW: 2010
Контактная информация:

Re: Sub vi connectior

Сообщение Bombbooo »

I already moved the event structure out into the main vi. It worked well with the correct values corresponding to the changed units. However, the unit outputs from the event sturcture are not correct (it's not the same as inputs). It seems to be right when the loop is running, but when I stop the while loop, the unit outputs are wrong. I tried to add shift register but it didn't solve the problem. These output units,which are not the same as inputs will appear in the saved text file.
Вложения
WriteDataToFile.vi
(22.2 КБ) 252 скачивания
Values Measurement 1-main(2).vi
(37.84 КБ) 250 скачиваний
Аватара пользователя
mzu2006

Professionalism Tutorials Black
doctor
doctor
Сообщения: 2456
Зарегистрирован: 16 авг 2008, 02:12
Награды: 3
Версия LabVIEW: 7.1 10 11 12
Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
Контактная информация:

Re: Sub vi connectior

Сообщение mzu2006 »

Just 2 more shift registers will do the job:
MZ_0407.jpg
Вложения
Values Measurement 1-main(2)_mz0407.vi
(25.12 КБ) 254 скачивания
Ответить

Вернуться в «For beginners»