LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with functional global

Solved!
Go to solution

Thsi is my first time experementing with functional globals

 

Having been recomended to read this thread http://forums.ni.com/ni/board/message?board.id=170&message.id=240328&query.id=5387854#M240328 

 

I have decided to start with just a functional global

 

(I like that term better as a FG should be just that, a global variable, and not perform any actions beyond holding data)

 

 What I have is "VI-A" writing to the FG and "VI-B" reading the FG

 

The problem I am having is: 

 

I can open the FG-VI in "VI-A" and see it updating.

 

If I open the FG-VI in "VI-B" the FG-VI is running but the controls and indicators are always in their default state and not being updated by VI-A

 

I have checked and checked and checked to make sure there is only one instance of the FG-VI on my machine.

 

I have even gone as far as dragging the FG-VI directly from the block diagram of "VI-A" to the block diagram of "VI-B"

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 16
(3,715 Views)
Post code please...
0 Kudos
Message 2 of 16
(3,708 Views)

Ok here you go,  I have added VI-A and VI-B to the two main VI's in question and all the sub VI's should be there, but it's not like you can run it anyway without my test set up and one of our units...

 

 

I threw together the chg-cycle VI rather quickly, it's messy and it has gone through a few changes due to equipment failure...

 

So please no comments on my amateur programming style.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 16
(3,700 Views)
Doh, can't open it cuz i don't have 2009. Don't fear however, I'm sure Ben will be along soon to point you in the right direction.
0 Kudos
Message 4 of 16
(3,692 Views)
Some things to check...Are your controls in the correct cases (write)? Are your wires wired through every case (i.e. don't use default if not wired). If you are using this option, you will see this...

 

 

 

Thats BAD!

Message Edited by for(imstuck) on 05-11-2010 11:18 AM
0 Kudos
Message 5 of 16
(3,686 Views)

Hi RTSLVU,

 

also throwing together two small test VIs to get rid of all your HW accesses, to show the FGV is working...

 

So maybe it wasn't a good idea to "I threw together the chg-cycle VI rather quickly, it's messy...". Remove the unwired default values and check again what's happening in your VIs!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Download All
Message 6 of 16
(3,674 Views)

GerdW wrote:

Hi RTSLVU,

 

also throwing together two small test VIs to get rid of all your HW accesses, to show the FGV is working...

 

So maybe it wasn't a good idea to "I threw together the chg-cycle VI rather quickly, it's messy...". Remove the unwired default values and check again what's happening in your VIs!


 

Yeah well I am not using that VI anymre anyway, besides it was a quick and dirty test that worked fine the day I needed it... The origonal chg-cycle had the comunication VI's built in it. I was just using it to learn the FG concept. The idea I had was VI-A would run and continusly update so you could see what the UUT was doing and VI-B could pull in the data it needs from the FG... Like I do with my measurement instrument (The Measurments global in teh chg-cycle vi)

 

Anyway I changed the FG back to how I first made it (no unwired defaults), but it still does not work as expected. The read in VI-B is always empty

 

 

 

========================
=== Engineer Ambiguously ===
========================
Download All
0 Kudos
Message 7 of 16
(3,662 Views)
Can you show the write case as it is now also? As far as the read case goes, that looks ok. Usually, you will place the controls in the write case, not outside the while loop.
0 Kudos
Message 8 of 16
(3,652 Views)

Look at this:

 

In fg screen1.jpg you can see CIB-FG.VI (opened from VI-A block diagram) being updated by "VI-A"

 

In fg screen2.jpg you can see CIB-FG.VI (opened from a new "VI-B" untitled block diagram that just reads the FG) and it is always in it's default state (empty)

========================
=== Engineer Ambiguously ===
========================
Download All
0 Kudos
Message 9 of 16
(3,644 Views)

for(imstuck) wrote:
Can you show the write case as it is now also? As far as the read case goes, that looks ok. Usually, you will place the controls in the write case, not outside the while loop.

 

Yeah, in the origonal thread I was looking at they said that putting the controls outside the loop has been benchmarked as faster then putting them inside...

 

I attached a snippet of one write case

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 16
(3,629 Views)