11-08-2023 01:54 PM
Retired and just playing around with the LV community addition to see how much I have lost. Now checking out some old test equipment.
Novice question:
I built a simple test program and got it to work but have an issue with the array indicator displays on the front panel. On start, the arrays are empty and greyed out as expected. Pressing the Run Test button starts a while loop that iterated and fill in the expected data then ends and returns to the main loop. Upon pressing the Run Test button again, I would like to have the arrays cleared before the next data set is added. Instead, new data is inserted into the arrays from the top (0 index) and the old data remains and is pushed downward. I can perform a “Data Operations, Empty Array” procedure from the Front Panel but can’t find a way to do it programmatically before the restart to the while loop. I have tried using property nodes with no success. Reinitialize to Default Value clears the display momentarily but then the old data returns.
PS, I know it’s not good form to use a local variable but could not recall any other way to reset the Run Test button.
Solved! Go to Solution.
11-08-2023 02:22 PM
Your main problem is the data being stored in the Feedback Nodes. Replace those with Shift Registers and you can then initialize the values to empty when the inner loop starts.
Along similar lines, you might as well just use Build Array instead of the Insert Into Array. They do the same thing, but the Insert Into Array makes things a little more complicated.
11-08-2023 03:33 PM
I spoke too soon accepting the solution. Made your suggested changes but I am still getting the old data so I must be missing something.
11-08-2023 03:34 PM
Revised VI
11-08-2023 04:26 PM - edited 11-08-2023 05:02 PM
OK, Got it. Just needed to add zero constants to the input terminals of the shift registers. That resets the values each time the RunTest is pressed.
Thanks!
11-10-2023 09:54 AM
@ee1993 wrote:
OK, Got it. Just needed to add zero constants to the input terminals of the shift registers. That resets the values each time the RunTest is pressed.
Thanks!
Yes, a "naked" shift register keeps values between runs, that's the "hack" behind Functional Globals.
11-13-2023 07:54 AM
Here is an update to my first attempt at a simple program. This should more closely follow good LabView practices and style. Event driven, so no polling in the outer loop. Any critique or suggestions are welcome.
11-13-2023 08:29 AM
There is no need for the wait in the main loop. The Event Structure will limit the loop rate.