LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem that can not initialize shift registers for while loop

Hello everyone, I am a new to Labview but I am doing my best to learn it asap.

 

Recently I met with a problem when using shift register that I can not initialize them with just DBL constant. Here below I have also attached my Vi, please check it.

 

My aim is to push the button FKP to run the case structure with input on the controller 'length shift','current length','current position and orientation', and it contains a while loop inside to run the iterative calculation (sorry that I can not use mathscript node for matlab since our computer can not install matlab inside). As a result it will return the optimized value out of the case structure to a controller 'motion'. Then pressing update, the new data will be refreshed to all the controllers.

 

I have linked the shift registers of while loop to different numerical constant, however when using probe as well as running the hightlight execution, I find that no nonzero value can be transfered insde the while loop as the starting point to begin the calculation. However, I have tried to put the initial value both outside and inside outer while loop (all outside inner while loop), yet, nether do they work....

 

Would anyone please give me some instructions on how to solve this problem that can not inititalize shift registers? What's wrong with my code?

 

Additionally, I wonder whether at the same time I can also initialize shift register with numerical array? (not only a number)

 

Looking forwards to hearing from you soon! Thank you very very much!

 

Best Regards~

 

PS: as input, you can try put all motion to zero, length and height to zero, current position and orientation to '0,0,186,0,0,0', length shift to '3,3,3,3,3,3'.

 

0 Kudos
Message 1 of 13
(2,890 Views)

In your lower case structure, the value in the outer shift regsiter is reset to zero whenever the false case executes. You need to wire the value across in the false case.

0 Kudos
Message 2 of 13
(2,887 Views)

thx Alterbach, however, I wonder should just create the shift register on the inner while loop, since I just need the while loop inside the case structure to run the iterative calculation and give me the result. If yes, does it mean that I can just create the initial value constant for shift register outside the case structure and still as what you suggested, link the initial constant through the false status too?

0 Kudos
Message 3 of 13
(2,855 Views)

Sorry Altenbach, I have tried your methods, however, it still cannot work, I have added different probe at every point along the line, but the initial value of 142.5 can just enter into the case structure, but still not the inner while loop..

 

what should I do? Any suggestions, pls! 

0 Kudos
Message 4 of 13
(2,851 Views)

Sorry I forgot to add the printscreen last time....

Download All
0 Kudos
Message 5 of 13
(2,848 Views)

Check my comment in your VI (attached).  See the bottom case structure.  Altenbach was right.  You also cannot have two different types of data going to a shift register (or tunnel through a case structure for that matter).  Let me know if this works for you.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 6 of 13
(2,839 Views)

Hello,

First thing to do is to wire the shift register through your false case as altenbach suggested.

Secondly, set a probe and breakpoint at the same position as probe number 4 in your second print screen,

You will see that the value does appear during the first iteration, the value for next loop is determined by the operations you perform and thats what is setting it to zero. Use execution highlighting to see what exactly is happening.

Hope this helps.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 7 of 13
(2,835 Views)

Thank you very much for you all! Yes, you are right Altenbach, maybe I think there is something wrong with my formula input inside ( I just wonder whether there is some function which can create the Jacobian matrix of 1st partial derivatives of multi-variable nonlinear equations systems, however, since I have not found yet, I calculated all of the 81 elements by hand and input all of them one by one, quite easy to make trouble....)

 

Btw, another questions pops up that during the erection of code these days, since the day before, every time I tried to open the Vi, it seems that the front panel just appears with flash and be minimized to the taskbar at the bottom of the screen. However, by clicking "ctrl +E" I can still open the block diagram and edit on it normally. Just I can not access to the front panel diagram.

 

Therefore, would you please do me a favor to answer me this question and tell me how to solve it? Since without operating on the front panel, I can not debug the code anymore, which is quite critical to me.

 

Thank you very much again!

 

Best regards and happy Eastern Day!

0 Kudos
Message 8 of 13
(2,769 Views)

@sophiey wrote:

Btw, another questions pops up that during the erection of code these days, since the day before, every time I tried to open the Vi, it seems that the front panel just appears with flash and be minimized to the taskbar at the bottom of the screen. However, by clicking "ctrl +E" I can still open the block diagram and edit on it normally. Just I can not access to the front panel diagram.


Is it possible that you had a dual monitor setup and the front panel is located outside the current screen? You can right-click the task bar entry and select "move", then move the front panel with the arrow keys until you see it again.

0 Kudos
Message 9 of 13
(2,765 Views)

Thx Alterbach, but is there any way to minimize the size of front panel window? Or anyway to make the front panel more compact so that we do not need the scroll bar?

 

0 Kudos
Message 10 of 13
(2,734 Views)