From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

question from a beginner

Need to see the new subVI. I do see that you're not passing a VISA Resource Name to the subVI. Unless you've set the default to be a valid com port, when called as a subVI the resource name may be empty.

p.s. You don't have to do separate posts to attach multiple files. The easiest thing to do is to create an llb with the main VI and all subVIs. Do this by selecting Save with Options>Development Distribution. You can also edit a post and attach a second or third file. The edit post is available from the Options button.
0 Kudos
Message 21 of 108
(1,467 Views)


@Dennis Knutson wrote:
Need to see the new subVI. I do see that you're not passing a VISA Resource Name to the subVI. Unless you've set the default to be a valid com port, when called as a subVI the resource name may be empty.

p.s. You don't have to do separate posts to attach multiple files. The easiest thing to do is to create an llb with the main VI and all subVIs. Do this by selecting Save with Options>Development Distribution. You can also edit a post and attach a second or third file. The edit post is available from the Options button.




Thank you very mucch. I attached the llb to this message.
0 Kudos
Message 22 of 108
(1,423 Views)
You're writing to com4. Are you sure that's the port you want? You should also use the error out connections of the subVI. If the subVI works standalone but not being called as a subVI, any errors you get might help to identify the problem.
0 Kudos
Message 23 of 108
(1,420 Views)


@Dennis Knutson wrote:
You're writing to com4. Are you sure that's the port you want? You should also use the error out connections of the subVI. If the subVI works standalone but not being called as a subVI, any errors you get might help to identify the problem.




Thanks. Before I run the Vi, I change com4 to com 1 (where pum is connected)in the front panel of the sub Vi. I also change the pump no to 0. Then I go to the Vi, click on the inf and rate below pump no 8 to activate. I then turn on the pump switch no 0, set up the time and run the program. Am I doing something wrong? When I run the sub Vi alone it works and I have no error out written in the front panel of the sub Vi. Thanks again
0 Kudos
Message 24 of 108
(1,415 Views)
Changing the resource name to com 1 in the subVI before you run the main does nothing. When the main calls the subVI, it passes the parameters it has to the subVI. Any input (with or without wired to the connector) that does not have a value wired to it in the main VI will be set to it's default value. The thing you should do is wire the resource name to the connector pane of the subVI and then explicitly wire a constant of Com1 to it in the main VI.
0 Kudos
Message 25 of 108
(1,412 Views)


@Dennis Knutson wrote:
Changing the resource name to com 1 in the subVI before you run the main does nothing. When the main calls the subVI, it passes the parameters it has to the subVI. Any input (with or without wired to the connector) that does not have a value wired to it in the main VI will be set to it's default value. The thing you should do is wire the resource name to the connector pane of the subVI and then explicitly wire a constant of Com1 to it in the main VI.




Thank you very much. Could you please do these modifications in the Vi and sub Vi I sent to you and send them back to me. I am very new in Labview, I actually just start learning. Thanks in advance
0 Kudos
Message 26 of 108
(1,409 Views)
Here it is. It's not as neat as I would like but it should work a lot better.
0 Kudos
Message 27 of 108
(1,403 Views)


@Dennis Knutson wrote:
Here it is. It's not as neat as I would like but it should work a lot better.




Thank you. I run the Vi that you sent me , but I still could not make it work. I probably do something wrong. I first go to the sub Vi front panel, I change com4 to com 1 (which i think is not necessary), I change the pump no to 00 (this is the adress of the pump, the sub Vi actually work only with this adress). I then open the front panel of the Vi, set the time, click the "inf" below pump 8 to activate, switch on pump 0 set up the rate below pump 0, then click on run of the Vi. I don't get any answer. Should I write something in filename root. I actually created a file in excell nammed pump log.xls that i saved in c:\. Thank you again
0 Kudos
Message 28 of 108
(1,397 Views)
Aurelia,

I made a quick change to the VI from what you posted, which may solve your problem. I think it is important to first explain how sub VIs work. A sub VI takes the data you pass into it, manipulates it or performs an action, and often outputs data back into LabVIEW. The sub VI will always use the data that was passed into it through its inputs. If there is nothing wired to the input it will use its default value. The default value can be changed by opening the sub VI, changing the value of the control, selecting Operate>>Make Current Values Default, and saving the sub VI.

It is important to understand this because you shouldn't ever have to open a sub VI and make changes before you run your program if it has been designed right. Changing the resource name to COM1, and the pump number to 00 inside the sub VI does nothing because both of these inputs were already receiving inputs from your main VI. If they are the wrong inputs then your main VI should be changed to pass the correct values to your sub VI.

Since you say the sub VI works by itself with COM1 and 00 as the pump number, I made a quick change to the way the pump number was formatted. Now if you set "#pumps" to 1 it will write to pump 00.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 29 of 108
(1,379 Views)


@Shawn B. wrote:
Aurelia,

I made a quick change to the VI from what you posted, which may solve your problem. I think it is important to first explain how sub VIs work. A sub VI takes the data you pass into it, manipulates it or performs an action, and often outputs data back into LabVIEW. The sub VI will always use the data that was passed into it through its inputs. If there is nothing wired to the input it will use its default value. The default value can be changed by opening the sub VI, changing the value of the control, selecting Operate>>Make Current Values Default, and saving the sub VI.

It is important to understand this because you shouldn't ever have to open a sub VI and make changes before you run your program if it has been designed right. Changing the resource name to COM1, and the pump number to 00 inside the sub VI does nothing because both of these inputs were already receiving inputs from your main VI. If they are the wrong inputs then your main VI should be changed to pass the correct values to your sub VI.

Since you say the sub VI works by itself with COM1 and 00 as the pump number, I made a quick change to the way the pump number was formatted. Now if you set "#pumps" to 1 it will write to pump 00.

Shawn B.
National Instruments




Thank you very much for very useful information. I cannot open the file that you sent me because I have the version Labview 7.0. What should I do? Thanks again
0 Kudos
Message 30 of 108
(1,377 Views)