09-12-2006 10:10 AM
09-12-2006 10:47 AM
09-13-2006 11:31 AM
09-13-2006 11:40 AM
10-12-2006 04:32 PM
10-13-2006 02:02 PM - edited 10-13-2006 02:02 PM
Hello,
The counts for each structure will only be reset when you stop and start the VI - the initialization on the shift registers applies once before entering the while loop, and thereafter the shift register contains the value which was wired to it on the previous loop iteration.
If you would like to save the value of the shift register across distinct runs of the VI you have a couple options:
1. If the VI will be left in memory (ie. open in the LabVIEW environment) between runs, then you can simply remove the shift register initialization outside the while loop. The result will be that the shift register will have an INITIAL value of 0 (the first time the VI is run, since opening it in the LabVIEW environment), but then will retain it's current value across subsequent runs of the VI, and therefore maintain your count across distinct runs of the VI.
2. If the VI will be open and closed between runs, then you'll need an external memory source, such as a file. The idea here is that you would read the counts from a file at the beginning of your program, and write the counts to a file at the end of your program. Basically you just retrieve the last count value from the file at the beginning, and make sure to update it when your VI is done so it has the updated value for the next run. Check out the File I/O palette and the shipping examples (in LabVIEW: Help -> Find Examples...) to help you get started, if you're not already familiar.
I think that should solve your problem.
Best Regards,
JLS
Message Edited by JLS on 10-13-2006 02:07 PM