10-17-2013 07:30 AM
Hi,
I have vi that uses shift register to modify a value with each iteration of the WHILE loop. However, I do not want the value to be modified on every iteration. There are some cases where I want the value in the shift register to remain fixed as the other operations in the WHILE loop execute during subsequent iterations of the WHILE, and, then, at some time later, I want the value in the shift register to resume being modified.
For example, in the attached sample code, a value of "2" is added on each iteration of the WHILE loop. Also, at each iteration, the LOOPER value is multiplied by 10. Suppose I want the shift register to increment by 2 only if the INPUT is greater than 1000, and the INPUT is known to fluctuate above and below 1000. When the INPUT boolean is TRUE, I want the shift register to increment by 2, but, if it is FALSE, I want the other function in the WHILE loop to continue executing, but, I want the SHIFT register to hold the last value and act on the last value when the boolean becomes true again.
For example, if the boolean is true we would see these values in the SHIFTER and LOOPER indicators, respectively:
2, 10
4, 20
6, 30
8, 40...etc.
If the boolean is true, false for 3 iterations, and then becomes true again, I WANT to see something like this...
2, 10
4, 20,
6, 30
8, 40
, 50
, 60
, 70
10, 80
12, 90
14, 100
Is it possible to pause (and resume) the incrementing of the shift register, without interrupting the execution of the other functions in the WHILE loop? I tried with a case structure, but,... couldn't figure out a way to put it together.
Thanks,
Solved! Go to Solution.
10-17-2013 07:35 AM
Hi dav2010,
can you please attach your code in LV2012.
Thankyou
10-17-2013 07:55 AM
How do you do that? I select "SAVE FOR PREVIOUS VERSION" and select 12.0, but, it creates a new folder, and then, when I check the PROPERTIES of the newly saved vi, it tells me that it is 2013 same as the original file I attached to the forum board. Very confused. Is there something else I need to check?
10-17-2013 08:14 AM
It sounds like a classic case of a case statement (pardon the pun). Have a case statement, pass the shift register through it for one state, modify it as you wish in the other(s). If the state is >1000, then a simple boolean check, with the "greater than" function, wired to the case.
10-17-2013 08:15 AM
Hi dav2010
i think you are following the right procedure, yes it creates a new folder that depends on you can also use the same folder to save by using current folder option but anyways creating a new folder is also not a problem, you can try once more to save it in previous version and this time don't open it in your pc which contains LV2013, on other side you can also attach a snippet of your code .
10-17-2013 08:16 AM - edited 10-17-2013 08:17 AM
You actually did save it on another version.
I use LV 12 and tried the "save for previous version", when you ask for the properties the window just shows the default program you use for opening LV, in your case 2013
See attachments below for screenshot, in this case i tried to open it with LV8
10-17-2013 12:59 PM
OK, I think that this is the version 12. Also, here is the block diagram in pictorial form, very simple.
10-17-2013 01:03 PM
As was said before, wrap a case statement around the "increment by 2" (or any other modifications to the shift register value) and have the case(s) selected by what ever you choose, in this case the input being > 1000.
10-17-2013 01:05 PM
Or maybe this is the version 12. I tried it several times, and it is very user-unfriendly and confusing. This one appears to say source "12.0"
10-17-2013 02:04 PM
Your most recent was in LabVIEW 2013. Have you tried the suggestions of how to solve the original question?