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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCPIP over Visa - connection handling

    Up until now, I've done TCPIP communication in LabVIEW using the TCP protocol VI's under Data Communication \ Protocols. With this, it is common to program a reconnect strategy, so that if your connection drops, you automatically attempt to reconnect. But that all has to be done at the LabVIEW level.

     I now have a simple example of using TCPIP over Visa, and would like to build on it. But I cannot find any definitive information on how VISA handles TCPIP connection issues. Is auto-reconnect built in at a low level, like Network Streams? Or do you just start getting time-out errors if the connection drops.

     I've done some forum searching, and have found a few posts that suggest that the latter is the case. One even said that VISA can't even detect whether the TCP connection is good or not. Where-as my possibly faulty recollection of the TCP protocol VI's is that you do get an error if the connection has dropped.

     At this point, I'm not even sure if the instrument uses the INSTR or Socket version of the VISA TCPIP connection, so answers on both/either would be appreciated.

 

Thanks,

     DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 1 of 5
(2,703 Views)

Well, I can help a little bit.  I've worked on a project where Mettler balances were sending serial data (weights) at 10 Hz, and all of the Balances (24 of them) were in a remote room.  They were connected to a "concentrator" that turned them into TCP/IP addresses.  I'm attaching Snippets of the two VIs we wrote to open them (based on the "Station number", from 1 to 24, with Stations 1..12 on one concentrator with 12 Ports and Stations 13..24 on another.

Get Balance IPGet Balance IP

Open BalanceOpen Balance

The "hidden Cases" in Open Balance are for a "Simulator" mode (for testing) and for "non-TCP/IP" VISA (for local trouble-shooting).  Hope this is useful.

 

Bob Schor

0 Kudos
Message 2 of 5
(2,642 Views)

Thanks, Bob. That's a great example. I've put serial devices over Ethernet before, but always had a driver on the computer that made them show up as a serial port. Didn't think about trying to do what you did...

One question regarding your solution: did you ever have connection issues? If the TCP connection ever goes away, what happens in your program?

 

Cheers,

    DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 3 of 5
(2,638 Views)

@Dave_Thomson wrote:

One question regarding your solution: did you ever have connection issues? If the TCP connection ever goes away, what happens in your program?

 


In a word, "Crashy-washy".  And sometimes a Balance will "go south", or the Switch will need to be rebooted ...  Usually doesn't happen in the middle of a run ...

 

Bob Schor

Message 4 of 5
(2,635 Views)

Ugh! NOT the answer I was hoping for!

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 5 of 5
(2,607 Views)