LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coercion problem when using Shared Variable

I have a curious coercion problem when using Shared Variables.  I want to share the state of a State Machine, which is an enum saved as a control (typedef) called TYPE State (see attached).  I create a shared variable called State and define it as a Custom Control, using the just-mentioned typedef.  So far, so good.  I've attached three simple VIs -- the first one, Init State, simply wires a constant to the input of the Shared Variable to initialize it -- the wired constant is, of course, defined by the typedef.  However, the Get State and Set State, meant to wire an indicator (for reading the state) or control (for setting it), develop coercion dots when wired into the Shared Variable.  Why?  How do I get rid of the dot?  [I suppose I could abandon my typedef and custom control, but the beauty of typedefs and custom controls is that it "enforces" rules, lets you use enums for clarity, keeps the code "honest", etc. -- I'd hate to give that up just to get rid of a dot!].

On a related note, the code seems to work.  This is much too simplistic to do anything, but if you open Set State and Get State, set the state to anything, run it (it immediately stops, of course), then run Get State, you'll see the chosen state appear in the indicator.  So it does appear to work.  The "error" (coercion dot) may, I suppose, be a "bug" in Labview because it can't figure out the mapping of the (very simple!) Custom Control, but if so, I hope it gets fixed quickly!

Bob Schor
0 Kudos
Message 1 of 3
(2,753 Views)
Hello Bob,

I am also seeing this behavior, I will escalate this question to our LabVIEW developers and post again here no later than next Tuesday, November 27th as National Instruments will be closed for the remainder of this week.

If this issue does turn into a product suggestion, I would suspect the workaround would to live with the coersion dot for the time being.

Enjoy the holiday 🙂

Regards,
Erik J.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,730 Views)
Hi Bob,

Unfortunately, the Shared Variable does not auto-update when created from a Typedef Custom Control.  I will file a product suggestion for it.

Thanks for your patience.

Regards,

Erik J.
Applications Engineer
National Instruments


Message Edited by Erik J on 11-27-2007 04:10 PM
0 Kudos
Message 3 of 3
(2,699 Views)