LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calling sub vi with shift regisers

My problem is that when I call a sub vi multiple times during execution of my main program, the shift registers used in the sub vi retain the data that they held from the previous time the sub vi was called. I have initialized the shift registers to be empty, but that only works if the main program is closed in between consecutive calls of the sub vi.

If anyone can help me understand why this is happening or has any suggestions on how I can re-initialize the shift registers without closing my program I would greatly appreciate it.

Thanks Laura
0 Kudos
Message 1 of 6
(2,459 Views)
If you are initializing the shift registers in the subvi outside the loop on the left hand register, it should be re-initialized with the value outside the loop everytime the subvi is called.

How are you initializing the shift register?

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 6
(2,447 Views)
I have initialized them in the same way as you have described, but it only re-initializes them if the program is closed between consecutive runs
0 Kudos
Message 3 of 6
(2,436 Views)
Are you sure you're calling the subVI multiple times? Like Ed said, if you're initializing from outside the loop AND the subVI stops and starts each time, it should be initialized. I suggest you post the relevant code and I'm sure someone will quickly find the answer.

___________________
Try to take over the world!
Message 4 of 6
(2,430 Views)
TST is correct. I think we're going to need to an example of how you have it coded to figure out what's going on.

If you can't post the entire application, can you make a quick example of just the subvi call?

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 5 of 6
(2,421 Views)
Thank you Ed and TST

after studying my code a little further I realized that the problem occurred due to a subvi of the subvi which contained shift registers that had not been initialized.


Thanks again for your time
Laura
0 Kudos
Message 6 of 6
(2,395 Views)