LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save, edit boolean controlled stopwatch

Hellow Fellow LabVIEW users

 

The attached is a stopwacth corresponding to this earlier forum post.

 

http://forums.ni.com/t5/LabVIEW/Reentrant-Boolean-Array-Controlled-stopwatch-SubVI/m-p/1334916#M5427...

 

I want to add to the solution and make my VI do the following 

a) With each iteration, I want the VI to save the values in each individual stopwatch, so even when the program closes and is reopened the values are intact.

b) When I press the "Edit B4" boolean an "Edit Time" control and "Edit and Save" boolean control array comes up. I want to be able to change the values of the original indicator array when I press the "Edit and Save" Boolen as well as revert back to the original array with the new values. 

c) I want these new Array values to be saved with the new iteration. 

 

I believe I should use an event structure.I also plan on using the SubVI 12 different times. Please let me know how I shuld proceed in this regard. Your help as always is greatly appreciated and needed. Please let me know if you need further clarification.

 

Thanks

 

mhaque

 

Download All
0 Kudos
Message 1 of 4
(3,036 Views)

Check out these examples for:

 

a. http://decibel.ni.com/content/docs/DOC-8222

 

b. http://decibel.ni.com/content/docs/DOC-5561

 

c. http://zone.ni.com/devzone/cda/epd/p/id/2492

 

Good Luck!

 

Drew T.

Drew T.
Camber Ridge, LLC.
0 Kudos
Message 2 of 4
(3,014 Views)

Drew answered the question about saving between runs, but I think your problem is much simpler

 

 


mhaque wrote:

a) With each iteration, I want the VI to save the values in each individual stopwatch, so even when the program closes and is reopened the values are intact.


 

What do you mean by "intact"? Should the program continue at the times where it stopped of or should it account for the time where the program did not run? For example if you close the program for one hour and start it again, should all active timers be one hour higher?

 

In this case you simply want to write the current contents of the start ticks feedback node and the boolean states to a flat binary file whenever they change (probably not very often). Use a file with a fixed name right next to the executable. Open the file once, then use lowlevel file IO for the duration of the program run and close when the program ends.

When the program starts, you can use the "first run?" primitive to reload the data into the shift registers as needed.

 

Make the subVI a proper action engine with several modes (init, normal run, overwrite timers, end, etc.). Remember, to customize the timers, you need to overwrite the shift regsiter contents inside the subVI.

 

Your use of property nodes is a bit clumsy. You don't need to write to all these property nodes with every iteration of the loop, they only need to be written when the boolean input changes (property nodes are relatively expensive because they force synchronous execution). Instead of the property nodes, you could just use a tab control with two tabs (e.g. run|edit) one containing the timers and one the edit time array. This eliminates the boolean switch and all property nodes.

 

What's the maximum duration of a program run? If it exceeds 10^32ms, you probably need to switch to timestamps instead.

 

Use a simple event structure in the toplevel program with the bulk of the code in a 1000ms timeout case. Add cases for "stop:value changed" and "edit time: value changed". 

 

0 Kudos
Message 3 of 4
(3,002 Views)

If the computer may be shut down between runs then you need to switch to timestamps.  The Tick Count restarts when the computer starts. A Tick Count based timer will not work correctly across computer restarts.

 

Lynn

0 Kudos
Message 4 of 4
(2,998 Views)