Setup Connection
Raw Socket
The basic implementation as it states by now is a RAW Socket implementation, so the connection information must be entered manually.
Establish a connection with NI Max
NI Max by National Instruments provides a simple and easy interface to setup and test a connection. If you want to add a new device head to Devices and Interfaces
, right click Network Devices
and select Create New VISA TCP/IP Resource
.
Select Manual Entry of Raw Socket
.
Now you have to enter the connection information. For the default settings this would be a Hostname of localhost
and a port number of 5025
. When entered you can validate the values you just entered. If the connection information is correct, the prompt should look like shown in the image.
If you want to add an alias to recognize your device more easily, you are asked to enter a name.
Now the setup should have been completed and you should find a new entry under your network devices. Click on Open VISA Test Panel
to test the communication.
A new window should open up.
Important
For a proper connection over RAW Socket we should adapt some settings. Under I/O Settings
change the I/O Protocol
to 488.2 Strings
and check Enable Termination Character
. Do not forget to click on Apply Changes
to save your settings. This settings must be made everytime you establish a connection, so keep in mind to set these parameters in the environment you intend to program the device.
Afterwards head to the Input/Output
tab and try to query for an identification of the device. Select the *IDN?\n
command and click Query
. Your device should respond with an identification string that could look something like the identification string shown in the image.
You successfully configured your measurement device!
Direct code integration
If you want to directly implement the connection into your code fragment, the important value is the resource string. The resource string contains all the relevant connection information. If you set up the connection in NI MAX the resource string can be found under Network Devices
- select your device - VISA Resource Name.
The default resource name is TCPIP0::localhost::5025::SOCKET
.
The different connection setup depends on your programming environment. The default setup for some setups are shown below, for more information please refer to the VISA library distributers documentation.
Note
Do not forget to adapt the settings for I/O Protocol and Termination Character