Lab::Instrument - General VISA based instrument
use Lab::Instrument; my $hp22 = new Lab::Instrument(0,22); # GPIB board 0, address 22 print $hp22->Query('*IDN?');
Lab::Instrument offers an abstract interface to an instrument, that is connected via GPIB, serial bus or ethernet. It provides general Read, Write and Query methods, and more.
Lab::Instrument
Read
Write
Query
It can be used either directly by the laborant (programmer) to work with an instrument that doesn't have its own perl class (like Lab::Instrument::HP34401A). Or it can be used by such a specialized perl instrument class (like Lab::Instrument::HP34401A), to delegate the actual visa work. (All the instruments in the default package do so.)
Lab::Instrument::HP34401A
$instrument = new Lab::Instrument($board,$addr); $instrument2 = new Lab::Instrument({ GPIB_board => $board, GPIB_address => $addr });
Creates a new instrument object and open the instrument with GPIB address $addr connected to the GPIB board $board (usually 0). All instrument classes that internally use the Lab::Instrument module (that's all instruments in the default distribution) can use both forms of the constructor.
$addr
$board
$write_count=$instrument->Write($command);
Sends the command $command to the instrument.
$command
$result=$instrument->Read($length);
Reads a result of maximum length $length from the instrument and returns it.
$length
$result=$instrument->Query($command);
Sends the command $command to the instrument and reads a result from the instrument and returns it. The length of the read buffer is haphazardly set to 300 bytes. This can be changed in the source code, hehe. Or you use seperate Write and Read commands.
$instrument->Clear();
Sends a clear command to the instrument.
$instr_handle=$instrument->Handle();
Returns the VISA handle. You can use this handle with the Lab::VISA module.
Probably many.
This is $Id: Instrument.pm 489 2006-08-13 15:07:14Z schroeer $
Copyright 2004-2006 Daniel Schröer (http://www.danielschroeer.de)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Schröer'. Assuming CP1252
To install Lab::Instrument, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lab::Instrument
CPAN shell
perl -MCPAN -e shell install Lab::Instrument
For more information on module installation, please visit the detailed CPAN module installation guide.