LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview SubVI's LED communication with the main VI problem

Dennis,
I agree the code that I have is pretty silly. It's more of a mock up that displays the basic idea compared to the actual code. The actual code uses 3 different instrument drivers and is pretty big, so I just wanted to get it down to the basic level for testing. I do need to have the LED in the SubVI case statement, because I am using a case statement to control each test that I have created. Currently there are 9 at the moment, but they all are dealing with the same issue to verify that the test passed or failed displayed for the user on the main VI. I wish that I could bring that LED out to the main program and the comparison test that goes along with it, but that was the point of making Subvi's to make things run faster and be better organized. If I went that route I would probably and I am not really kidding, but have about 80 of those LED's on the main VI just for the comparison test for each testing signal.
If there are any questions from anyone that doesn't fully understand what I am trying to do let me know and I'll be more than happy to explain it to you.

0 Kudos
Message 11 of 17
(845 Views)
Does anyone know a solution to my problem?
0 Kudos
Message 12 of 17
(838 Views)
I guess I still don't understand what you are having problems with. With your unmodified VI, it I set the front panel control to be true and then run it, after 5 seconds it returns a True and updates the front panel.
0 Kudos
Message 13 of 17
(830 Views)
Dennis,
You are right if you do set the Main VI switch to true all the time it will eventually show a true on the front panel LED, but the problem is I can't do that with the switches. The tests don't allow a long period of time to run the test. Only a quick toggle switch will work, which is why I have delays in the program, so the instrument can run, read the data, store it then move on to the next read. The problem is the front panel switch in the Main VI has to toggle on and off quickly just a simple click and it goes high to low. I am not sure if that makes it impossible to receive a high for the Main VI LED, because of the switch unless I stored the info into a file then brought it back to be read by that LED.

0 Kudos
Message 14 of 17
(824 Views)
I'm in the same boat as Dennis here. I've been reading this, and I looked at your VIs, but I'm not sure what it is you are trying to accomplish. What I think is going on is that you don't quite grasp the concept of dataflow. It looks like you want to be able to change the toggle switch in the sub VI (or maybe the main VI) and see it immediately affect an LED in the other VI. This is not possible with a simple sub VI call. Only one of those VIs will be running at one time. They don't "communicate" while they're running unless you set up some mechanism, such as a queue. The main VI runs, processes everything it can up to the sub VI call, calls the sub VI, then halts execution until the sub VI is finished. In your example this will take 5 seconds when the input to that sub VI is set to true.

Maybe I'm way off, this is just what occurred to me when I posted the first time, and it still appears to be what's going on.
0 Kudos
Message 15 of 17
(813 Views)
I'm still a little confused too but see if the attached modified VIs do what you want them to.
Download All
0 Kudos
Message 16 of 17
(808 Views)
Dennis,
I believe that fixed the problem. All I had to do was take the two vi's that you edited and put the subvi also in the false statement. That way the switch on the Subvi VI will act just like the main VI. That was pretty much teh only problem I saw with what I need to accomplish and what you had. I can't have the subvi's switch on all the time since there are 7 other tests that will be running eventually and call some of the same functions.
Thanks Dennis I really appreciate your help and I hope this really does fix the problem. I won't really know until I put it all in the program and go from there.
Jason
0 Kudos
Message 17 of 17
(779 Views)