Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 62 occurred at TCP

Hi,

 

i am trying to operate a spectrometer remotely and the problem is that when I put all the subvis in a main vi in sequence structure it gives error 62 just after executing first command while subsequent commands fail to execute. All other subvis work perfectly when I run them alone. And every subvi first go through open command i.e. every subvis first open the connection before sending the main commands. Could anyone please suggest some solution? 

 

thanks

 

anshuman

0 Kudos
Message 1 of 7
(6,375 Views)

You would need to show us some code. You've probably forgotten to wire up some references between VIs. The best thing to do is to post your VI. If you're using an instrument driver provide a link to the instrument driver that you're using so you don't have to upload the instrument driver VIs.

0 Kudos
Message 2 of 7
(6,361 Views)

Hi,

 

thanks for the reply. Here I am attaching the main vi and two subvis in´which one is to open the connection and it is input to every subvis, As I said all the subvis work fine separately but when i tried them together in one main vi then only first sequence get executed and for all other it shows Error 62. I am clueless about this error.

Download All
0 Kudos
Message 3 of 7
(6,358 Views)

You should only be opening the connection once, at the beginning of your program, and then closing it once your program ends. You're opening connections in multiple places, and not even closing any of them. You did not indicate wher you got the other subVIs, such as "set_res", so I have no way of knowing what they do internally. If they're also fiddling with opening TCP connections on their own then you need to change the subVIs so they take in a connection reference as an input, and provide a copy of the connection reference as an output so they rely on the calling program to manage the connection.

 

You also have NO error handling. You are ignoring all of the error clusters. They're there for a reason. Wire them up, and you will also find that you can use them to daisy-chain your VIs so you don't even need to use the sequence frame.

 

Message 4 of 7
(6,352 Views)

Hi.

 

thanks for your prompt reply. Since at every TCP write connection id is needed therefore I tried to generate with it with open connection vi and it works well for the individual vis but doesn't seem to work with one program. Since I am beginner in Lab view therefore could not think of any other way to generate connection id, i also tried to generate the id with the help of TCP listen but no success. I would be great if you can help me in this aspect.

Thanks a lot.

 

 

0 Kudos
Message 5 of 7
(6,348 Views)

The Open Connection function is the correct function to use. It makes no sense to use TCP Listen unless you are a listener and waiting for someone else to connect to you. My point is that you do not want to be opening the connection multiple times, which is precisely what you're doing. Just look at your code. In the first frame you call the set_wavelns VI which calls open_ready, which opens a connection. In the second fram you call open_ready again, which opens another connection. Why? You already have an open connection. As I said, open the connection at the beginning of your code, do what you need to do, and then close at the end.

 

Another way you could do it is to use an event structure. You could have a button for opening and closing. See attached example to get you started.

Message 6 of 7
(6,342 Views)

Hi,

 

Thanks a ton for your help. Now i understood my mistake n rectified them. I am attaching the main programs and subvis, please have a look, now the thing is I am opening connection only once at the beginning of the main vi and then using the connection id generated by the open subvis as a input to other subvis, please tell if there is a any other good way to do it. But there is problem that i am not able to get error output when there is a case structure in subvis and same for the connection id out. 

Besides I also tried to work with event structures but i am not able to add any control event as no options appear, i tried to learn from the help but still confused.

 

Thanks for your time and help.

 

anshuman

0 Kudos
Message 7 of 7
(6,312 Views)