LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

refreshing the while loop that uses uninitialized shift register

Hi All

 

I have made a sample VI which contains a while loop and used an uninitialized shift register to retain the old values. The question is even when I forcefully stop the while loop iteration by pressing the STOP button and re-run the program the input of the uninitialized shift register start from the previous value but not from the first.

 

I do not want to use the initialized shift regsiter and just want to use some logic to refresh the uninitialized shift register so that whenever I want to stop the program and re-run the input should start from 0 and not the previous value.

 

Pls c the attached image. Appreciate your response

 

THnaks

Robin.

0 Kudos
Message 1 of 5
(3,004 Views)

I have no idea why you don't like the initialized shift regsiter, because it offers exactly the functionality you want.

 

In any case, you could use a "select" wired to the iteration terminal via a "=0" comparison to reset the content in the first iteration.

 

I don't understand your code. What's the purpose of the case structure? What's in the other case?

It is always better to attach a VI instead of a picture to make thing more clear to us. Thanks!

0 Kudos
Message 2 of 5
(2,999 Views)

Wire a "First Call?" node to the boolean input of a Select.  Wire the shift register to the false input, and your desired initial value to the true input.  Wire the output to whatever connected to the shift register.  Now on the first call of your VI, you'll get your initial value.

0 Kudos
Message 3 of 5
(2,998 Views)

the reason I dont want to use initialized shift register is actually in my original program I am reading values from the multicolumn list box and the outline of the program is to read each row and then move to the next row and once it is at the end of the row then jump again to the first row and so on....

 

so the reason to find logic for refreshing the uninitialized shift register is....suppose when my original program is in between say 3rd or 4th iteration reading the values from a row and I want to STOP the program. In such case when I re-run the program my original program reads the value from the previous row but not start from the first row and I don't want this to happen.

 

Is there anyway to do this. Hope you understood.

0 Kudos
Message 4 of 5
(2,992 Views)

See attached image, which does what you want and is exactly what I suggested in my previous message.

initialize shift register on first call.png

0 Kudos
Message 5 of 5
(2,988 Views)