This help contains information on using the VISA Library Application Programmer’s Interface (API) under Scilab.
VISA
The Virtual Instrument Software Architecture (VISA) is a standard for configuring, programming, and troubleshooting instrumentation systems comprising GPIB, VXI, PXI, Serial, Ethernet, and/or USB interfaces.
VISA provides the programming interface between the hardware and development environments.
GPIB
GPIB (General Purpose Interface Bus) comes from IEEE-488 standard. It is a short-range digital communications bus specification. It was created for use with automated test equipment.
Pre-requisites
Appropriate hardware, in the form of a National Instruments GPIB,GPIB-VXI, MXI/VXI or serial interface board.
For GPIB applications, install NI-488. For VXI applications, install NI-VXI. For other hardware interfaces, NI-VISA uses the system’s standard drivers.
You can use both National Instruments (GPIB) and Agilent/HP (HPIB) Controllers in the same System :
To activate the interface between NI_VISA and Agilent, you must enable the NiTulip mode of NI_VISA. Under Windows :
Search "NI MAX" in order to start it.
In "NI MAX" go to "System"->"Software" and select "NI-VISA".
In "NI-VISA" go to "My System"->"General Settings" and select "Passports".
Check NiTulip.dll.
You can find this information here.
Get the list of connected devices
To connect between your computer and your device you need the address of the instrument.
For this, run the findAllInstruments() which gives you the list of all connected instruments:
Open a session
viOpenDefaultRM() creates a session and returns its identifier.
Connect to a device
To open a communication with the first connected device:
[status, idDevice] = viOpen(defaultRM, deviceAddrs(1), viGetDefinition("VI_NULL"), viGetDefinition("VI_NULL")); | ![]() | ![]() |
Send commands
Once connected, you can send commands to your instrument using the function viWrite().
Read data
The viRead() is used for this purpose:
Read attributes
You can also read one of the instruments attributes with the viGetAttribute() function.
This function needs a pointer on the attribute, so you need to create a pointer of the attribute type, then pass it to the function.
Then, you will need to read the pointer value, use the dedicated function for this:
pQueueLength = new_ViPUInt16(); status = viGetAttribute(idDevice, viGetDefinition("VI_ATTR_MAX_QUEUE_LENGTH"), pQueueLength); queueLength = ViPUInt16_value(pQueueLength); | ![]() | ![]() |
Disconnect from the device
The communication with the device is over, you can close it using the function viClose().
Close the session
The same command is used to close the session.