LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Bob_Schor

Allow creation of Shared Variable Refnums on the Front Panel

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

A brief digression.  I am doing some Real-Time programming with LabVIEW 2012, and decided to check out the very complete Real Time Control sample project.  As NI intended, I started modifying it to suit my particular Real-Time task.  This Project uses Network-Published Shared Variables to send "Monitoring Data" from the RT Target to the Host.  I changed the type of one of the Shared Variables from Array of Double to Array of UInt8, but noticed that on the Host UI, the output was still a Double.

 

This project uses a cluster of Shared Variable References, passed from the RT Target to the Host.  I decided to simply "change" the Shared Variable Reference that was returning the "wrong" type with a new Reference that I could (so I thought) bind to the redefined Shared Variable.

 

I spent well over an hour (more like 2-3) looking for the Shared Variable Reference (or Refnum) on the Control Palette.  One logical place for it to be would be on the Refnum sub-Palette, but it is not there!  I noticed that the reference was of type "Variable Object", so I tried to create a Control Refnum and change its Server Class to Variable Object -- can't be done.  On the I/O sub-Palette, there is a Shared Variable Control, but this is something different -- it is not a Shared Variable Reference.  Finally, I tried copying my Shared Variable to the Block Diagram and right-clicking and doing a "Create Reference", but this option does not exist.

 

I tried doing a search to learn how to do what I wanted to do, namely to change the Shared Variable Reference so that it "referenced" an Array of UInt8.  Naturally, because I didn't already know the Answer to my Problem, I didn't search for Shared Variable Reference (and even if I had, the information out there is scant).

 

Here are several recommendations to Prevent Frustration in Users Trying to Use the NI Sample Projects (with specific reference to Shared Variable References).

 

1)  Put a Shared Variable entry on the Refnum sub-Palette.  This is the logical place to look to create a Front Panel Refnum.

2)  Allow the user to right-click a Shared Variable on the Block Diagram and have, as an option, Create Reference.

3)  If you leave the Shared Variable Control on the I/O page, consider also putting the Shared Variable Reference there (granted, it might not belong, but it's better to be in the Wrong Place than in No Place).

4)  Put a Shared Variable Reference Control on the Shared Variable sub-Palette on the Data Communications Palette.

 

Note that Point 4 is almost already done, but I just didn't realize it!  You do have the option on this sub-Palette to put a "Local Variable Object Reference" on the Block Diagram (how that for an obscure description?), and if you change this to a Control, presto, you have a Shared Variable Refnum control.

 

So what seems to be the "solution" to my problem?  I called a colleague on the phone and we noodled this together, and came up with two "insights".  First, the existing Shared Variable Reference that was returning (on the UI Main Block Diagram) an Array of Double could be changed to return an Array of UInt8 by right-clicking, choosing Properties, then opening the right-hand Configuration tab (which I hadn't noticed).

 

How about creating a Reference Control specific to a chosen Shared Variable?  Put an instance of the Shared Variable on the Block Diagram, right-click, and select "Replace with Programmatic Access" (also not so intuitive!).  This changes the Shared Variable into a Shared Variable Reference Constant, so if you want a Control, just right-click and "Change to Control".  You also will need to delete the Read Variable function that gets put on the Block Diagram.

 

It really doesn't need to be this difficult, nor this obscure, particularly if it involves a Sample Project!

 

BS

 

1 Comment
Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.