LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Add Network Device (VISA)

Oh, you ran into the limitation that DAQmx scales require the channel ranges to be in scaled units didn't you?  And there are a few bugs back there too involving strain and accel simulated devices.  Then you have to roll your own.  Brian gave you some good advice on that.

Just don't ever make the mistake of fixing a bug in an NI driver vi.  The bug fixes don't deploy for $hit.  Trust me, I tried that once, I learned better.

 

Stop laughing!


"Should be" isn't "Is" -Jay
0 Kudos
Message 11 of 24
(2,031 Views)

@JÞB wrote:

 

Stop laughing!


Then stop tickling me!  Thanks for the comments.  Off to Beat on VISA, will report back.

 

BS

0 Kudos
Message 12 of 24
(2,014 Views)

You ever figure out how to do this?  Similar situation.  

0 Kudos
Message 13 of 24
(1,841 Views)

@Bob_Schor wrote:

@JÞB wrote:

 

Stop laughing!


Then stop tickling me!  Thanks for the comments.  Off to Beat on VISA, will report back.

 

BS


Hello @Bob_Schor 

Did you ultimately find a solution to this?. Can you please share the results.

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 14 of 24
(1,338 Views)

@djac91 wrote:

@Bob_Schor wrote:

@JÞB wrote:

 

Stop laughing!


Then stop tickling me!  Thanks for the comments.  Off to Beat on VISA, will report back.

 

BS


Hello @Bob_Schor 

Did you ultimately find a solution to this?. Can you please share the results.


For the laughing and tickling? 😀

 

As far as the original problem is concerned you need to be more specific. If the device is not an NI friendly device (such as a GPIB, USB-TMC or VXI-11 device, which all have their somewhat standardized ways to be discovered) you should most likely only rely on VISA aliases if you do not intend to distribute/clone the system to other stations.

Opening VISA sessions with a properly formatted Resource Identifier in the form of "TCPIP0::<ip>::<port>::SOCKET" works absolutely perfect for me, so if you know your IP address and port number or can build a small configuration interface to let the user enter them you are all set. VISA Find Resources only can work for the above mentioned instrument devices as there is no generic way to discover and query other devices and especially TCP/IP devices.

 

TCP/IP was not designed with an inherent discovery protocol. To do so is anyhow pretty hard as you get into the problem of Baron Münchhausen who had to drag himself out of the swamp. In order to do discovery you need a protocol but if that discovery is part of the protocol you have a problem. Because of that there are about a zillion different ways TCP/IP devices tend to boot up and acquire their IP address and/or advertise their local address on a network. And every manufacturer has his own prefered method to implement that by choosing one of those zillion methods.

The serial interface is even worse as they do generally not adhere to anything but their own protocol.

Rolf Kalbermatter
My Blog
0 Kudos
Message 15 of 24
(1,327 Views)

Thanks for the response.

 

 

The device I am communicating with is a supper motor controller that both usb and Ethernet interfaces. The serial commands are in ASCII form and is common for both the interface. Only one interface is active at a time.

 

My plan is to use the same VIs for both the interfaces as the commands are same. Only this that will change is the VISA resource name based on the interface type selected. My intention is to avoid developing a separate module using TCP functions in LabVIEW as this can be done via VISa TCP/IP. But I don't want to do any MAX configuration.

 

Based on your comments i hope that using the format TCPIP0::<ip>::<port>::SOCKET works directly without configuration in NI MAX.

 

Thanks.

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 16 of 24
(1,318 Views)

@djac91 wrote:

 

Based on your comments i hope that using the format TCPIP0::<ip>::<port>::SOCKET works directly without configuration in NI MAX.


It always did for me so I don't see a problem there. And yes if the device is really completely the same for both interfaces it can be as simple as using an "ASRL<port>::INSTR" and a "TCPIP0::<ip>::<port>::SOCKET" resource identifier, depending on the interface you want to use. Although in practice you usually will have to do some interface specific handling in at least the Initialize function as you need to set the serial port baudrate, databit, parity and message termination method for the serial port variant. But that is very easy as once you called VISA Open, one of the VISA properties tells you what type of VISA sessions you have and then you can simply do conditional code based on that.

Rolf Kalbermatter
My Blog
Message 17 of 24
(1,310 Views)

@rolfk wrote:

@djac91 wrote:

 

Based on your comments i hope that using the format TCPIP0::<ip>::<port>::SOCKET works directly without configuration in NI MAX.


It always did for me so I don't see a problem there. And yes if the device is really completely the same for both interfaces it can be as simple as using an "ASRL<port>::INSTR" and a "TCPIP0::<ip>::<port>::SOCKET" resource identifier, depending on the interface you want to use. Although in practice you usually will have to do some interface specific handling in at least the Initialize function as you need to set the serial port baudrate, databit, parity and message termination method for the serial port variant. But that is very easy as once you called VISA Open, one of the VISA properties tells you what type of VISA sessions you have and then you can simply do conditional code based on that.


This is exactly my plan. Only thing is I don't have the hardware with me at this time. So I had to confirm if the method works or not before spending time on the implementation. I guess now the doubts are cleared.

 

Thank you very much

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 18 of 24
(1,302 Views)

@djac91 wrote:

This is exactly my plan. Only thing is I don't have the hardware with me at this time. So I had to confirm if the method works or not before spending time on the implementation. I guess now the doubts are cleared.


This is one of the joys of VISA: It is a bus abstraction layer.  You just have to initialize the bus and the rest of the code will work regardless.  I actually made a library just to handle VISA sessions and it is almost completely initialization.  I build up my sessions based on parameters in a configuration file.  But I can initialize it based on a COM port number, Ethernet Address, GPIB Address, or a preconfigured session (mostly for USB interfaces that do not show up as COM ports).  Here is a snippet for how I create an Ethernet VISA session.  If a socket is not supplied, then I just build the resource using the address.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 19 of 24
(1,297 Views)

I have to admit that I "do it pragmatically".  My colleague, who runs the studies using his research equipment, has a pair of Serial-to-Ethernet "concentrators".  He can query them by using a Web browser pointed to their IP, and they provide a report of what devices are connected to what ports.

 

In the present configuration, we have a series of "Stations" numbered 1 to 24, with the first 12 assigned to the switch at IP address 172.18.112.1 and remaining assigned to 172.18.112.110.  So knowing the Station number, I can subtract 1 (to put it in the range 0 .. 23), do a Quotient/Remainder, with Remainder being the Socket and Quotient choosing the correct IP, and construct the TCP/IP address for the Balance.  Then I use the TCP/IP "VISA Open" command, as shown below.  Crude, but effective ...

UTIL Get Balance IP.pngUTIL Open Balance.png

Snippets (LV 2018) attached.  Should be simple enough to create "by hand" for earlier versions ...

 

Bob Schor

Download All
Message 20 of 24
(1,279 Views)