ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reentrant Boolean Array Controlled stopwatch SubVI

Solved!
Go to solution

I am in the final stages of implementing my program.

 

Currently I have to overcome two obstacles .

 

#1 corresponds to the attached VI "My stopwatch"

The round LED starts counting the time and stops it. Problem is even if I turn it off it, the timer keeps counting the seconds when I turn it on again. I want it to accumulate only the time it spent in the on position. How do I do this?

 

#2 corresponds to the VI "array of time".

I want to use "My stopwatch" as a reentrant subVI in this VI. I want the round LED Boolean array as the control to switch the stopwatch on and off.

 

Thanks for all your help.

 

mhaque

 

 

Download All
0 Kudos
Message 1 of 11
(6,654 Views)

Check out the CLD exam example solutions.

 

One of them for the Car-Wash includes a modification of the "Elapsed timer function" that add a "Pause" Smiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 11
(6,637 Views)

On a sidenote, have you ever wondered what would happen if you would remove the "equals true?" and wire straight from the terminal to the rest of the code? 😄

 

 

(see also)

0 Kudos
Message 3 of 11
(6,628 Views)

aaaaaaaaaah so its pointless having the equals to sign.

 

I was just using someone elses code.

 

Thanks for clarfification.

 

mhaque

0 Kudos
Message 4 of 11
(6,584 Views)

We just call that WEC.   or Wire Equivalent CodeSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 11
(6,570 Views)

I have managed to modify an existing VI to do what I want i.e. have one start/pause Boolean control for the stop watch.

 

Criticisms please. The block diagram looks simple enough.

 

Also I can't quite get it to reset.

 

Any suggestions.

 

Thanks

 

mhaque

0 Kudos
Message 6 of 11
(6,558 Views)

I have managed to make a Boolean Array controlled stopwatch.

 

It is within a while loop. My question is how do I use this VI as a SubVI? How do I overcome the while loop?

 

I found this thread

 

http://forums.ni.com/t5/LabVIEW/handling-while-loop-in-subvi/m-p/1117918

 

but since I am new to LabVIEW I do not understand how they got over the issue using the VI server reference and Value Change Property node.

 

They use references but I don't understand how the reference controls tie in with the coding.

 

Your help is much appreciated.

 

mhaque

0 Kudos
Message 7 of 11
(6,520 Views)
Solution
Accepted by mhaque

To use it as a subVI, it is easiest to use globally initialized feedback nodes. Here's a quick example.

 

(Place both VIs in the same folder, then run CallTimerSubVI)

 

You are using way too much code. Please rethink what you did! Also study my example.

 

 

  • Instead of 24 shift registers use three, containing arrays of 8 elements (or the number of timers you need).
  • You need a resolution of one second, so place a wait inside the loop. There is no need to spin it 10 million times per second, you are just wasting cpu cycles and starving all other programs.
  • One diagram constant of 1000 is sufficient (instead of 16!). You can branch the wire.
  • Why divide both values by 1000, then add? Add first and divide once!
  • Why invert the booleans, just swap the cases if needed?
  • (Even if you really want to invert all booleans, do it once on the array side.)
  • This is a small VI, why maximize to the screen?
  • Note that my code scales well. A few minor changes would allow it to be used with 100 timers. To do the same with your program design would be impossible. 😄

 

Message 8 of 11
(6,495 Views)

How long did it take you to get this good? Seriously?

 

It works perfectly! wow!

0 Kudos
Message 9 of 11
(6,479 Views)

Shoot I meant to reply to this post instead of

 

http://forums.ni.com/t5/LabVIEW/Can-LabVIEW-pickup-from-where-it-left-off/m-p/1334910#M542745

 


 

Hey altenbach

 

Where does the VI initialize, i.e from where are the zero filled arrays created.

 

I want to place a read/write binary file and I am wondering where I should wire it to, to save the timers when I exit the program.

 

Otherwise the timer starts from 0 which is not what I want.

 

Thanks

 

mhaque

 


 

Since you solved both problems I hope this is not too much of an inconvenience.

0 Kudos
Message 10 of 11
(6,376 Views)