08-03-2017 04:05 PM
Hey guys I have a pretty simple question. How can I extract the numeric value assigned to a ring constant into something like a numeric indicator?
Solved! Go to Solution.
08-03-2017 04:18 PM
Just wire it to a numeric indicator.
They are the same data type, so it will wire up just fine.
08-03-2017 07:05 PM
That's what I thought but when I'm running the program it always show 0 on the indicator.
08-03-2017 07:57 PM
Well if it's a ring constant the output will always be the same until you change it. Try changing the item in the ring. If you are having problems with that, attach your code so we can take a look at what you are doing.
08-03-2017 08:00 PM
@Caleb963 wrote:
That's what I thought but when I'm running the program it always show 0 on the indicator.
That's not the behavior I see.
Post your VI so we can see how you are doing things.
08-04-2017 04:41 PM
The program itself is quite messy with lots of Sub-VIs but the one of interest is "MFC controller main."
Not sure why but when the ring constant is used on an independent VI it operates flawlessly but causes issue in this one.
08-04-2017 05:11 PM
I think you are only reading the ring control and writing to the indicator only ONCE in you program. Try changing the ring constant to something else BEFORE you hit the run button and see if the indicator changes to the other value.
08-04-2017 06:58 PM
@Jacobson-ni wrote:
Well if it's a ring constant the output will always be the same until you change it. Try changing the item in the ring. If you are having problems with that, attach your code so we can take a look at what you are doing.
Is that why they call it a "constant"?
08-04-2017 09:32 PM - edited 08-04-2017 09:40 PM
@Caleb963 wrote:
The program itself is quite messy with lots of Sub-VIs but the one of interest is "MFC controller main."
Not sure why but when the ring constant is used on an independent VI it operates flawlessly but causes issue in this one.
When I strip out all the extra code, or at least a large amount of it, it works for me. Why it doesn't with the other code in I can't say. It could be tied to several architecture problems with your code. You have several while loops where the stop condition is controlled by a boolean wire entering through a tunnel. That means that loop will either run one time if the value happens to be True. Or will run forever if that value happens to be false.
Also, the while loops are greedy meaning there is no wait function in them to keep them from burning up your CPU.
Numerous feedback nodes that really don't look correct, and will never actually execute because the while loops feeding them data are likely to run forever. But even if they did get data from the while loops, they would never execute more than once because they are on the top level of the main block diagram. They aren't in a while loop that would allow them to execute again.
I see subVI's that have event structures, while loops, and stop buttons that can never be pressed because the front panels aren't ever opened. How do you press a stop button to stop a while loop if you can't press the stop button? The event cases are set to lock front panel until completed, but the event structures are likely to be a freeze point in your code because there is no way for the event to ever be fired.
Probably numerous other issues.
I suggest reading:
Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help
and also
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
I'm sorry, but this code is an absolute mess and needs to be thrown out and re-coded with a much cleaner architecture. The ring constant value being shown as a numeric is the least of your problems.
08-07-2017 03:32 PM
Very well, I'll read more into it and will see what I can do.