| Lab-VISA documentation | view source | Contained in the Lab-VISA distribution. |
Lab::VISA::Installation - Installation guide for Lab::VISA
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.
Work with administrator account during installation.
Install VISA (and GPIB drivers) if necessary.
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.
Install gnuplot (not mandatory)
pgnuplot.exe to path:
My Computer => Properties => Advanced => Environment VariablesInstall 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
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"'
perl Makefile.PL
nmake
nmake install
Install Lab::Instrument and Lab::Tools
perl Build.PL
perl Build
perl Build install
Have fun!
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 website
Install only 'Run Time Support' (I chose all items below that; it's not much)
Locate msc version of visa32.lib and visa.h and adjust Makefile.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::MakeMaker
perl 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 and LDLOADLIBS. 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
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
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__
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.
| Lab-VISA documentation | view source | Contained in the Lab-VISA distribution. |