06-01-2010 04:47 PM
The other subvi. It is in build stages, so wiring maybe all over the place. Any tips on better programming also welcome.
V
06-01-2010 04:50 PM
VeeJay wrote:Actually, instead of the big subvi part, I am attaching an example program. Here, I can see that both loops run parallelly (if that is a word) but updates are not continuous on the main vi while subvi's are running. Help!
The eg_mainvi VI is empty. Not going to see much with that.
06-01-2010 05:04 PM
Lol :0 I uploaded the program while it was still open. I guess I didnt save it. Here are the versions that work (hope so)
Thanks!
V
06-01-2010 05:04 PM - edited 06-01-2010 05:06 PM
VeeJay wrote:The other subvi. It is in build stages, so wiring maybe all over the place. Any tips on better programming also welcome.
V
You previously attached vi, subvi_elevation.vi, is way too huge. Anything more than one screen is too big. You should make use of more subvi's to keep the block diagram small enough to fit one screen. When a block diagram is this big, it is very difficult for someone else to understand what is happening. It is also very difficult to debug. If you turn on highlite execution, you have to constantly scroll all over the place to keep up with the execution flow. Please try to modularize your code to make it easier to follow.
06-01-2010 05:10 PM
initially, I had done this main vi. Both cases in one while loop.
V
06-01-2010 05:13 PM - edited 06-01-2010 05:15 PM
Hey tbob! How do I further modularize that code? I think I can put math and error calculations in separate vi's. I do think further modularizing it will make it easier programmatically, but then there would be subvi's within subvi's and too many references. wouldn't that make the program more complex? Anyway, I will try and modularize as much as possible as you said. But, in the example program, that is kind of the problem I am facing with respect to updating main vi from subvi's/.
Thanks!
V 🙂
06-01-2010 05:22 PM
If you are expecting to see the numerical result in your main vi while the subvi is running, it won't happen. You need to reference for the numeric to do this. Create a reference for the numeric in main. Create a new control reference in the subvi. Wire the main numeric reference to the subvi reference. Then in the subvi, write to a value property node of the new reference.
I fixed subvi 2. Do the same for subvi 1. See attached.
06-01-2010 05:25 PM
VeeJay wrote:Hey tbob! How do I further modularize that code? I think I can put math and error calculations in separate vi's. I do think further modularizing it will make it easier programmatically, but then there would be subvi's within subvi's ....
Thanks!
V 🙂
Message Edited by VeeJay on 06-01-2010 05:15 PM
I have lots of code with subvi's nested down many levels. This is called modular programming. Each subvi has a particular small function. Put them all together to create a large function. If you have to pass references far down, so be it. If you have many references, you could bundle them into a cluster, and pass the cluster to all subvi's. Then the subvi would have to unbundle to get the proper reference. Believe me, this will make it much easier to troubleshoot.
06-02-2010 01:41 PM
@tbob Thanks for the tips! Would it also work if we reference the indicator from the subvi into the main vi just the way we do it for sending values to the subvi? Would two way referencing work?
Also, I am working OT and noting down what functions of my existing program can be modularized. I will post you on my progres.. Thanks! 🙂
V
06-02-2010 01:45 PM
VeeJay wrote:@tbob Thanks for the tips! Would it also work if we reference the indicator from the subvi into the main vi just the way we do it for sending values to the subvi? Would two way referencing work?
No. Think about. How are you going to connect a main VI's connector pane to the subVI?
To access a subVI's front panel from a higher level VI you need to open a VI reference to the subVI and then navigate the Front Panel property's list of controls.