NI Home > Community > NI Discussion Forums

Instrument Control (GPIB, Serial, VISA, IVI)

Reply
Member
Brian Ramos
Posts: 12
0 Kudos

TCP Listen connection to VISA

Hi,

 

Is there any way of going from a TCP connection returned from TCP Listen into a VISA Resource?  I have a set of VIs that communicate over the serial port and I'd like to use them over TCP/IP but I hit a road block on the listener. If there's anyway I can create a TCP listener with VISA I'd appreciate the help.  Thanks!

 

- Brian

Active Participant nyc
Active Participant
Posts: 1,912
0 Kudos

Re: TCP Listen connection to VISA

Have you looked at Data Communication --> TCP --> TCP Create Listener ?

Member
Brian Ramos
Posts: 12
0 Kudos

Re: TCP Listen connection to VISA

Yes, that only returns a TCP connection which is not compatible with VESA functions. You can typecast from a TCP VISA connection to a TCP connection but it doesn't look like you can do the reverse.

Active Participant nyc
Active Participant
Posts: 1,912
0 Kudos

Re: TCP Listen connection to VISA

Why is it important that it has to "become" a VISA resource?

 

 

Member
Brian Ramos
Posts: 12
0 Kudos

Re: TCP Listen connection to VISA

I have a bunch of VIs that communicate via a serial port and all of the serial port functions in LabVIEW are VISA functions.  My VIs take a VISA resource as an input, using VISA read and write to do their operations. I can open an outbound TCP socket with VISA and uses these VIs just fine but I need to listen for an incoming TCP connection on the server-side.

 

So I'm looking for a way of either using VISA to listen for a TCP connection or convert the TCP connection returned by TCP Listen to a VISA resource that my VIs can use.

Member
MilanR
Posts: 139
0 Kudos

Re: TCP Listen connection to VISA

Hi Brian,

 

You can actually create a VISA resource for a TCP/IP device by just formatting a resource string. The necessary format can be seen in the KB How Do I Control Ethernet Instruments with NI-VISA and it sounds like you would need to use the Socket configuration unless the device supports the INSTR protocol. You can then pass that resource into standard VISA VIs like VISA open, etc.


Milan
Applications Engineering
National Instruments
ni.com/support
Member
Brian Ramos
Posts: 12
0 Kudos

Re: TCP Listen connection to VISA

Hi Milan, thanks for the reply. I have no problems creating out bound TCP connections. What I'm looking for is the ability to listen, via VESA, for an incoming connection. There doesn't appear to be any way to do this. I want to do this because I would like my VIs to be agnostic to the underlying link (serial, TCP, etc.).  Otherwise, I have to have duplicated VIs for TCP and serial.

Knight of NI
Dennis_Knutson
Posts: 33,153
0 Kudos

Re: TCP Listen connection to VISA

Is the instrument actually creating the connection? A serial instrument would not and I have not used a TCPIP instrument that creates the connection. What is the instrument?

Member
Brian Ramos
Posts: 12
0 Kudos

Re: TCP Listen connection to VISA

Looks like I created a bit of confusion here. There is no instrument or rather, I want my VI to be the "instrument". My VIs, both server and client, talk to each other. I've needed them to talk over both serial and TCP/IP. I was hoping to use VISA to make them agnostic to the underlying communications link. My first approach was to make my VIs accept VISA resources as the VISA functions work for both serial and TCP/IP. This works great except for the fact that there doesn't seem to be a way to make my VI wait for an incoming TCP connection using VESA. The only LabVIEW functions to do this are "TCP Listen" and "TCP Create Listener" but I can't go from the TCP connection ID those VIs return to a VESA resource that I can pass to my VIs to talk to each other.

Knight of NI
Dennis_Knutson
Posts: 33,153
0 Kudos

Re: TCP Listen connection to VISA

So is the serial one using the VISA Bytes at Serial Port? If so, there is no TCP/IP equivalent. You could try using a VISA Read with a short timeout.