LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with Elapsed Time function and shift register

Solved!
Go to solution
0 Kudos
Message 11 of 15
(600 Views)

@Canucks.canucks wrote:

This is my VI. I want my while loop stops after a certain amount of time. I created a shift register to see how many times the loop was running. the problem is if i enter for example 1 second, it shows a value . Then if i stop my program and run it again with 1 second this shift register value is different. even when i close my program, reopen ,run and enter 1 second the shift register is different. what am i doing wrong?

 


Your Shift register is not initialized.  Therefore the value will be retained on the shift register as long as the vi is in memory (or until it recompiles)  Moreover, the count will increment multiple times for each press of Run

 

Lets look at it, 

When Run is latched the value is read once as True and the inner while loop starts and will iterate until the "Time Has Elapsed" Boolean is true.  Maybe a 1.21jiggatimes! it depends on how fast the CPU is.  If you want a count of how many delays increment the value only when the Loop exit condition exists (hint: use select)

 

As for the value of How Long, The Terminal is read as soon as you run the vi and that value is placed on the wire.  The the value on the front panel can't change the value on the wire until the outer loop iterates!  Do look through some of the basic tutorials Altenbach mentioned.


"Should be" isn't "Is" -Jay
0 Kudos
Message 12 of 15
(596 Views)

equal zero like this?

i did initialize my shift register

0 Kudos
Message 13 of 15
(586 Views)

There is no "equal zero". Did you attach the correct VI?

 

If you would give your VIs reasonable names (not "Untitled....vi") it might be much easier to keep track of them. Note that every single VI you have attached in this thread has the same name, but they are not all the same!

0 Kudos
Message 14 of 15
(574 Views)
Solution
Accepted by topic author Canucks.canucks

See if this gives you some ideas ....

0 Kudos
Message 15 of 15
(570 Views)