LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with "Less" Function in LabVIEW 2015

Solved!
Go to solution

OK, so the while loop and shift register can be deleted and we have the following

  • a time input in units of seconds
  • wait based on input, stalling the calling VI (not good)
  • output a new value (probably to be feed as input in the next call, maybe). What is this output and how is it actually used?

Does it always start with an input of zero? It is really not a good idea to stall the calling VI for tens of seconds, because it limits user interaction. What is the overall architecture of the caller? Does this run in a parallel loop for the UI code? How do you interrupt the long waits, e.g. if you want to stop the program early?

 


@GavinSheehan wrote:

 

If I select a Hold Down test, my code performs the same function but it cuts out the intervals from 0-1 second and jumps straight to 1 second intervals.

 


So this is only a tiny difference between the two cases, so why would you have all that duplicate code? All shared code belongs outside the case structure.

 

I'll have a look at this later and maybe make some suggestions.

0 Kudos
Message 11 of 16
(1,571 Views)

GavinSheehan wrote: 

I'd love to hear ways to improve and alter this because I spent a loooong time trying to figure out a way to do it to suit my needs.

OK, here's a quick draft that should work OK if the input is well formed. See if it can give you some ideas. Please verify correct operation, there could be bugs, of course.

 

Download All
Message 12 of 16
(1,543 Views)

Do you have access to LabVIEW online training? You could go through LabVIEW Core 1 and 2 (and 3), to learn clean programming techniques.

0 Kudos
Message 13 of 16
(1,530 Views)

Yeah I do. I have completed Core 1 and 2 and I'm inthe process of doing 3. I've been using LabVIEW for about 2 years but I'm only now getting into big projects. As I said above, my code is usually very clean but in this case I just wanted it to work to start!

0 Kudos
Message 14 of 16
(1,524 Views)

I've tested that out and it looks to work very well! Thank you! I'll see if I need to adjust anything to make it work in my code but I don't think I have to!

0 Kudos
Message 15 of 16
(1,517 Views)

@GavinSheehan wrote:

Yeah I do. I have completed Core 1 and 2 and I'm inthe process of doing 3. I've been using LabVIEW for about 2 years but I'm only now getting into big projects. As I said above, my code is usually very clean but in this case I just wanted it to work to start!


Your original problem was not really a programming issue, but an algorithmic one. Yes code can get ugly when randomly testing variations to get the correct result, but here it required a fresh approach instead of brute forcing all possible scanrios with pages of code.

If you can explain the task in one sentence and with basically no exceptions, there is enough symmetry that a mathematical solution should exists. You simply need to find it. 😄  I am sure there are further simplifications possible.

Good luck!

Message 16 of 16
(1,501 Views)