LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset uninitialized shift register

Hi all, new here...

Right now I am using an uninitialized shift register to keep track of my loop count despite stopping and starting the while loop several times throughout the course of running my VI.  (In my code, the loop I am talking about is the small while loop in the bottom).  I tried initializing my shift register, but every time the while loop gets called, it reinitializes to zero and starts searching the top of the array instead of starting where it left off.  This is a pattern matching program which basically tries to find the # of separating cells between two similar arrays.  Is there a way to solve this problem using an initialized SR?  The counter I am having trouble with is labeled "D/A Counter" which I would like to start at zero and continue in increments of one to search the array.

Thanks,
ayudell

Message Edited by ayudell on 06-20-2007 01:34 PM

0 Kudos
Message 1 of 5
(4,794 Views)
There's a function in the Synchronization palette called First call that outputs True the very first time it gets called, and False afterwards. Have a Case Structure inside your while loop that depends on this function and outputs zero for true, and wires the value through for False.


Message Edited by Jarrod S. on 06-20-2007 01:50 PM

Jarrod S.
National Instruments
0 Kudos
Message 2 of 5
(4,781 Views)

ayudell,

Its sounds like you are talking about an Action Engine.

Reply #38 illustrates a similar construct to Jarrod's.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 5
(4,755 Views)
I assume that you want to start over at zero whenever the VI starts. Why don't you add another shift register on the outer FOR loop, initialize it to zero, and feed it the last value of the inner while loop on the right side?
 
You should also avoid all these wires going in all directions and stay with a logically arranged left-to-right data  flow. For example your sequence structure serves no purpose. An index array wired to [i] can be replaced by an autoindexing tunnel.
 
I took the liberty to rearrange your code a bit (no change in dataflow) to clear up the diagram a bit and remove soe dead wood. Maybe it can give you some ideas. Sorry, I don't really understand what your code is supposed to do, but I am sure many thing could be simplified much further.
 
 
 
 
0 Kudos
Message 4 of 5
(4,746 Views)
Thanks for all the help, I've got it figured out now
0 Kudos
Message 5 of 5
(4,710 Views)