01-19-2008 05:23 PM
01-20-2008 01:33 AM - edited 01-20-2008 01:35 AM
01-20-2008 10:26 PM
01-20-2008 11:30 PM
Yes a shift register is the preferred method for a task like that. Since you did not say what exactly you wanted to increment, I did not go there. 😉
However, your VI has problems and can be improved as follows:
If you would place an indicator at the iteration counter, you would see that your while loop always spins as fast as the computer allows, many millions of times per second. This consumes all CPU for no reason at all. This is much faster than any user interaction can take place and thus overkill. Much better is an event structure. Now the loop only spins when one of the buttons is pressed. The reaction time of the code is actually faster because you are not polling the controls and, at the same time, the VI uses insignificant amounts of CPU (~ zero!).
Since you are counting integers, you should also use a blue representation (e.g. I32) instead of orange (DBL) for the counter. I added a button to decrement the value of needed.
See if this makes sense. 🙂
01-21-2008 04:03 AM
hey, thanks.
the vi i attached was just a scope of what i needed. i'm using it in a bigger VI which works in the attached VI (below). so the while loop is necessary.