LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String Indicator has trouble displaying numbers. Takes a while...

So I have a number of String Indicators that are pointing toward a Global Variable that represents a Matrix, itself filled with numbers that the String Indicators are pointing to. Each Indicator is pointed to a different element in the Matrix. Most of the Strings do their job and display the correct info right when the VI runs. But for some...they eventually display the correct numbers. You can see them flickering for several seconds until they're shown solidly in the Strings. So, what is this about? Why do the numbers flicker? Sorry, I usually show my code, but I was hoping it was a simple solution because it's a lot of code. But I will if it isn't an easy solve.

0 Kudos
Message 1 of 4
(1,824 Views)

Unfortunately, it is a code problem, which means you'll have to show it to get some help.

 

I don't know what you mean by "string indicators that are pointing towards a global variable".  What is that concept?  The rest of your description describes a data structure that just does not sound natural.

 

If there is too much code, try giving us a simpler version of it that shows the same problem.  Perhaps in building a simple version, you'll be able to help yourself solve the bigger version of the problem.

0 Kudos
Message 2 of 4
(1,778 Views)

Sounds like a common debug problem to me.

If they flicker, they have value that you do not expect. Turn on retain wire values. Try to use conditional probe that will pause execution if there is wrong value (empty string). Or just set a breakpoint to pause every time indicator updates value and check where wrong value is coming from.

 

PS:

Guess 1: Numeric type mismatch problem: negative value where it can only be positive (index array for example). 

Guess 2: Uninitialized shift register since it does not work first time.

0 Kudos
Message 3 of 4
(1,718 Views)

If I understand you correctly... you have string indicators with contents that are numbers.

 

These are contained across a number of VIs

 

These VIs all write to a single global variable.  That global variable is the collection of all of these string indicators in a matrix.

 

Yikes.  Let's get back to that in a second and first step back to understand why people here think it's a code issue (and what should have stood out to you as well).  You state you have multiple VIs.  Some show the behavior.  Others don't.  This means it's not something with the global itself.  You're working with something that's different across the VIs.  Without knowing what you're doing in each, it's difficult to point out what's causing them to behave differently.

 

 

Now, let's get back to that structure.  When I see things like that, I ask why the developer hates themselves.  Nothing about that sounds pleasant.  If the values are numbers, eliminate the strings.  

 

Why would multiple VIs be writing this same global?  That's asking for pain.  I'd be very surprised if you didn't have a race condition in place somewhere (separate from the behavior you're seeing now in some of these VIs).  I can't fathom a clean way to be writing to this monstrous data structure that doesn't require writing the entire data set with each update.  If you're doing that, any chance that two places of the code acting at roughly the same time means you're going to have instances where one write is simply discarded.  If it's worth writing, it's probably worth making sure it gets written correctly.

 

Without seeing your code, I'd expect you could make a reproducing case by eliminating the vast majority of the VIs and settling on just two: one that works and one that doesn't.  Include the global variable.  And, you should be able to figure something out.  Though, I could be wrong depending on what the code itself looks like.

Message 4 of 4
(1,691 Views)