NAME
Lab::VISA::Installation - Installation guide for Lab::VISA
Introduction
Lab::VISA has been tested to work on Linux and Windows, both with ActiveState Perl and the Microsoft VC++ Compiler, and Strawberry Perl with the included gcc compiler.
Installation on Windows XP with ActiveState Perl
Work with administrator account during installation.
Install VISA (and GPIB drivers) if necessary.
Download current VISA release from NI (tested with 4.4.1, 4.5.0)
Run installer
Check location of visa32.lib (eg. C:\Programme\IVI Foundation\VISA\WinNT\lib\msc\visa32.lib) and remember for later.
Install Microsoft Visual C++ from http://www.microsoft.com/express/Downloads/
From now on run all commandline programs during installation only from the "Visual Studio Command line", which can be found in the Start menu.
Install Perl.
Tested with ActivePerl from http://www.activestate.com/Products/activeperl/index.mhtml
Make sure to include Perl Package Manager.
Make sure to activate the check box to include perl directory in PATH variable.
Install gnuplot (not mandatory)
Download from http://sourceforge.net/project/showfiles.php?group_id=2055 (gp425win32.zip)
Extract and put it somewhere
Add directory containing
pgnuplot.exe
to path: My Computer => Properties => Advanced => Environment Variables
Install dependencies of our perl modules. Depending on how familiar you are with the perl infrastructure, the easiest might be to use PPM, the Perl Package Manager included with ActivePerl.
Lab::Tools needs
XML::Generator (PPM would write it as XML-Generator) XML::DOM XML::Twig YAML
Install Lab::VISA
Unzip/copy sources
In file
Makefile.PL
adapt the LIBS and INC settings according to your installation (the location looked up above). This is what worked for me:'LIBS' => ['-"lC:\\Programme\\IVI Foundation\\VISA\\WinNT\\lib\\msc\\visa32.lib"'] 'INC' => '"-IC:\\Programme\\IVI Foundation\\VISA\\WinNT\\include"'
You can find the LIBS folder by checking the registry key "InstDir" in folder "HKEY_LOCAL_MACHINE\SOFTWARE\National Instruments\NI-VISA for Windows 95/NT".
Run the following commands in the source directory
perl Makefile.PL nmake nmake install
Install Lab::Instrument and Lab::Tools
Unzip/copy sources
Run the following commands in the source directory
perl Build.PL perl Build perl Build install
Have fun!
Installation on Windows XP with Strawberry Perl
Strawberry Perl is a Perl distribution for Windows that most closely mimics a Perl installation under Linux. It comes with gcc compiler, dmake and the other relevant tools included.
Lab::VISA should in principle install out of the box with just the command
cpan Lab::VISA
executed on the commandline. Unfortunately there is a bug in ExtUtils::MakeMaker (see here) that prevents this. Two possible workarounds are explained below.
Have Windows and Strawberry Perl installed
Install NI-VISA
Download 361mb file
visa462full.exe
from NI's websiteInstall only 'Run Time Support' (I chose all items below that; it's not much)
Locate msc version of
visa32.lib
andvisa.h
and adjustMakefile.PL
. This is what worked for me:'LIBS' => q("-lC:/Programme/IVI Foundation/VISA/WinNT/lib/msc/visa32.lib"), 'INC' => q("-IC:/Programme/IVI Foundation/VISA/WinNT/include"),
Work around the bug (known to be present in ExtUtils-MakerMaker-6.56)
Option 1: Patch ExtUtils::MakeMaker
Apply the change described at https://rt.cpan.org/Ticket/Display.html?id=49026 to the file
Kid.pm
of your installation of ExtUtils::MakeMakerperl Makefile.PL
Option 2: Edit generated Makefile
If you don't like to modify the installed version of ExtUtils::MakeMaker, you can edit the generated Makefile. These changes will be lost after executing
perl Makefile.PL
again though. This option is recommended if you just want to install Lab::VISA.perl Makefile.PL
In the generated file
Makefile
:Find the two lines containing the words
EXTRALIBS
andLDLOADLIBS
. Add the"C:\path\to\visa32.lib"
to each of of these lines. On my system they read:EXTRALIBS = "C:\Programme\IVI Foundation\VISA\WinNT\lib\msc\visa32.lib" C:\strawberry\c\lib\libmoldname.a ... LDLOADLIBS = "C:\Programme\IVI Foundation\VISA\WinNT\lib\msc\visa32.lib" C:\strawberry\c\lib\libmoldname.a ...
dmake
dmake install
Installation on Linux
As a Linux user you will probably be able to figure out things yourself. Here is a rough outline:
Before you start, you must have the VISA library by National Instrument installed. If you plan to use GPIB connections (which is very likely), you must also have the necessary drivers (NI-488.2) for your GPIB adapter card installed. Refer to National Instruments' very good documentation for additional information:
In file
Makefile.PL
adapt the LIBS and INC settings according to your installation. This is what worked for me:'LIBS' => ['-lvisa'], 'INC' => '-I/usr/local/vxipnp/linux/include/',
Then do the usual
perl Makefile.PL make make install
Testing the installation
Here is a quick test program that you can run with perl -Mblib test.pl:
#!/usr/bin/perl
use Lab::VISA;
my ($status, $sesn) = Lab::VISA::viOpenDefaultRM();
printf "status: %x (%s)\n", $status, (($status == $Lab::VISA::VI_SUCCESS) ? "success" : "no success");
print "sesn: $sesn\n";
my ($status, $findList, $retcnt, $instrDesc) = Lab::VISA::viFindRsrc($sesn, "ASRL1::INSTR");
printf "status: %x (%s)\n", $status, (($status == $Lab::VISA::VI_SUCCESS) ? "success" : "no success");
print "findList: $findList\n";
print "retcnt: $retcnt\n";
print "instrDesc: $instrDesc\n";
__END__
COPYRIGHT AND LICENCE
This is $Id: Installation.pod 660 2010-04-25 20:31:56Z schroeer $
(c) 2010 Daniel Schröer, Andreas Hüttel, Daniela Taubert, and others.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 324:
Non-ASCII character seen before =encoding in 'Schröer,'. Assuming CP1252