NAME
Lab::Instrument - General VISA based instrument
SYNOPSIS
use Lab::Instrument;
my $hp22 = new Lab::Instrument(0,22); # gpib board 0, address 22
print $hp22->Query('*IDN?');
DESCRIPTION
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.
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.)
CONSTRUCTOR
new
$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.
METHODS
Write
$write_count=$instrument->Write($command);
Sends the command $command
to the instrument.
Read
$result=$instrument->Read($length);
Reads a result of maximum length $length
from the instrument and returns it.
Query
$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.
Clear
$instrument->Clear();
Sends a clear command to the instrument.
Handle
$instr_handle=$instrument->Handle();
Returns the VISA handle. You can use this handle with the Lab::VISA module.
CAVEATS/BUGS
Probably many.
SEE ALSO
- Lab::VISA
- Lab::Instrument::HP34401A
- Lab::Instrument::HP34970A
- Lab::Instrument::Source
- Lab::Instrument::KnickS252
- Lab::Instrument::Yokogawa7651
- Lab::Instrument::SR780
- Lab::Instrument::IPS120_10
AUTHOR/COPYRIGHT
This is $Id: Instrument.pm 475 2006-08-10 22:06:46Z 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:
- Around line 237:
Non-ASCII character seen before =encoding in 'Schröer'. Assuming CP1252