-
-
29 Apr 2019 15:01:27 UTC
- Distribution: Lab-VISA
- Module version: 3.20
- Source (raw)
- Pod Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (2 / 0 / 0)
- Kwalitee
Bus factor: 1- % Coverage
- License: unknown
- Activity
24 month- Tools
- Download (39.12KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- DynaLoader
- Exporter
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Lab::VISA - Perl interface to the National Instruments VISA library
SYNOPSIS
use Lab::VISA;
DESCRIPTION
This library offers a Perl interface to National Instruments' NI-VISA library. Lab::VISA provides a low-level interace; it is one of the possible backends for the high-level measurement control package Lab::Measurement [1].
This document describes the Perl syntax of the API. Each function is explained with some sentences cited from [2]. See this manual for further documentation on the library.
Installation instructions for Lab::VISA can be found in Lab::VISA::Installation.
[1] http://www.labmeasurement.de/
[2] NI-VISA Programmer Reference Manual. Part Number 370132C-01. http://www.ni.com/pdf/manuals/370132c.pdf
FUNCTIONS
viClear
$status=Lab::VISA::viClear($vi);
The
viClear()
operation performs an IEEE 488.1-style clear of the device.viClose
$status=Lab::VISA::viClose($object);
The
viClose()
operation closes a session, event, or a find list. In this process all the data structures that had been allocated for the specified vi are freed. CallingviClose()
on a VISA Resource Manager session will also close all I/O sessions associated with that resource manager session.viFindNext
($status, $instrDesc)= Lab::VISA::viFindNext($findList);
The
viFindNext()
operation returns the next device found in the list created byviFindRsrc()
. The list is referenced by the handle that was returned byviFindRsrc()
.viFindRsrc
($status, $findList, $retcnt, $instrDesc)= Lab::VISA::viFindRsrc($sesn, $expr);
The
viFindRsrc()
operation matches the value specified in theexpr
parameter with the resources available for a particular interface.On successful completion, this function returns the first resource found (
instrDesc
) and returns a count (retcnt
) to indicate if there were more resources found for the designated interface. This function also returns, in thefindList
parameter, a handle to a find list. This handle points to the list of resources and it must be used as an input toviFindNext()
. When this handle is no longer needed, it should be passed toviClose()
.The search criteria specified in the
expr
parameter has two parts: a regular expression over a resource string and an optional logical expression over attribute values. The regular expression is matched against the resource strings of resources known to the VISA Resource Manager. If the resource string matches the regular expression, the attribute values of the resource are then matched against the expression over attribute values. If the match is successful, the resource has met the search criteria and gets added to the list of resources found.All resource strings returned by
viFindRsrc()
will always be recognized byviOpen()
. However,viFindRsrc()
will not necessarily return all strings that you can pass toviParseRsrc()
orviOpen()
. This is especially true for network andTCPIP
resources.viGetAttribute
($status, $attrState)= Lab::VISA::viGetAttribute($object, $attribute);
The
viGetAttribute()
operation is used to retrieve the state of an attribute for the specified session, event, or find list.viOpen
($status, $vi)= Lab::VISA::viOpen($sesn, $rsrcName, $accessMode, $openTimeout);
The
viOpen()
operation opens a session to the specified resource. It returns a session identifier that can be used to call any other operations of that resource. The address string passed toviOpen()
must uniquely identify a resource.For the parameter accessMode, the value
VI_EXCLUSIVE_LOCK
(1) is used to acquire an exclusive lock immediately upon opening a session; if a lock cannot be acquired, the session is closed and an error is returned. The valueVI_LOAD_CONFIG
(4) is used to configure attributes to values specified by some external configuration utility. Multiple access modes can be used simultaneously by specifying a bit-wise OR of the values other thanVI_NULL
. NI-VISA currently supportsVI_LOAD_CONFIG
only on Serial INSTR sessions.viOpenDefaultRM
($status, $sesn)= Lab::VISA::viOpenDefaultRM();
The
viOpenDefaultRM()
function must be called before any VISA operations can be invoked. The first call to this function initializes the VISA system, including the Default Resource Manager resource, and also returns a session to that resource. Subsequent calls to this function return unique sessions to the same Default Resource Manager resource.When a Resource Manager session is passed to
viClose()
, not only is that session closed, but also all find lists and device sessions (which that Resource Manager session was used to create) are closed.viRead
($status, $buf, $retCount)= Lab::VISA::viRead($vi, $count);
The
viRead()
operation synchronously transfers data. The data read is to be stored in the buffer represented by buf. This operation returns only when the transfer terminates. Only one synchronous read operation can occur at any one time.viSetAttribute
$status=Lab::VISA::viSetAttribute($vi, $attribute, $attrState);
The
viSetAttribute()
operation is used to modify the state of an attribute for the specified object.viWrite
($status, $retCount)= Lab::VISA::viWrite($vi, $buf, $count);
The
viWrite()
operation synchronously transfers data. The data to be written is in the buffer represented by buf. This operation returns only when the transfer terminates. Only one synchronous write operation can occur at any one time.CAVEATS/BUGS
Not all API functions are supported. Only GPIB, serial, and TCP/IP connections have been tested so far.
SEE ALSO
- GPIB
-
This module can also provide instrument connectivity from perl, but builds on top of GPIB instead of the higher level VISA. I could never make it work properly. It seems to be unmaintained for a while.
- http://pyvisa.sourceforge.net/
-
As the website states, the PyVISA package enables you to control all kinds of measurement equipment through various busses (GPIB, RS232, USB) with Python programs.
This project was indicated to me only recently by a Lab::VISA user. It looks very similar.
AUTHOR/COPYRIGHT
This swig-based interface is (c) 2004-2006 Daniel Schröer (c) 2007-2010 Daniel Schröer, Andreas K. Hüttel, Daniela Taubert, and others (c) 2011-2014 Andreas K. Hüttel It is free software; you can redistribute it and/or modify it under the same terms as Perl itself. For the rest National Instruments or the VXI Consortium will probably have a word to say. See National Instrument's license for the NI-VISA library.
Module Install Instructions
To install Lab::VISA, copy and paste the appropriate command in to your terminal.
cpanm Lab::VISA
perl -MCPAN -e shell install Lab::VISA
For more information on module installation, please visit the detailed CPAN module installation guide.