Lab::Bus::LinuxGPIB - LinuxGPIB bus
version 3.771
This is the GPIB bus class for the GPIB library linux-gpib (aka libgpib0 in the debian world).
linux-gpib
libgpib0
my $GPIB = new Lab::Bus::LinuxGPIB({ gpib_board => 0 });
or implicit through instrument and connection creation:
my $instrument = new Lab::Instrument::HP34401A({ connection_type => 'LinuxGPIB', gpib_board => 0, gpib_address=>14, }
See http://linux-gpib.sourceforge.net/ for details on the LinuxGPIB package. The package provides both kernel drivers and Perl bindings. Obviously, this will work for Linux systems only. On Windows, please use Lab::Bus::VISA. The interfaces are (errr, will be) identical.
Note: you don't need to explicitly handle bus objects. The Instruments will create them themselves, and existing bus will be automagically reused.
In GPIB, instantiating two bus with identical parameter "gpib_board" will logically lead to the reuse of the first one. To override this, use the parameter "ignore_twins" at your own risk.
my $bus = Lab::Bus::GPIB({ gpib_board => $board_num });
Return blessed $self, with @_ accessible through $self->config().
gpib_board: Index of board to use. Can be omitted, 0 is the default.
gpib_board
Lab::Bus::GPIB throws
Lab::Exception::GPIBError fields: 'ibsta', the raw ibsta status byte received from linux-gpib 'ibsta_hash', the ibsta bit values in a named hash ( 'DCAS' => $val, 'DTAS' => $val, ... ). Use Lab::Bus::GPIB::VerboseIbstatus() to get a nice string representation Lab::Exception::GPIBTimeout fields: 'Data', this is meant to contain the data that (maybe) has been read/obtained/generated despite and up to the timeout. ... and all the fields of Lab::Exception::GPIBError
$GPIB->connection_new({ gpib_address => $paddr });
Creates a new connection ("instrument handle") for this bus. The argument is a hash, whose contents depend on the bus type. For GPIB at least 'gpib_address' is needed.
The handle is usually stored in an instrument object and given to connection_read, connection_write etc. to identify and handle the calling instrument:
$InstrumentHandle = $GPIB->connection_new({ gpib_address => 13 }); $result = $GPIB->connection_read($self->InstrumentHandle(), { options });
See Lab::Instrument::Read().
Lab::Instrument::Read()
TODO: this is probably not correct anymore
$GPIB->connection_write( $InstrumentHandle, { Cmd => $Command } );
Sends $Command to the instrument specified by the handle.
$GPIB->connection_read( $InstrumentHandle, { Cmd => $Command, ReadLength => $readlength, Brutal => 0/1 } );
Sends $Command to the instrument specified by the handle. Reads back a maximum of $readlength bytes. If a timeout or an error occurs, Lab::Exception::GPIBError or Lab::Exception::GPIBTimeout are thrown, respectively. The Timeout object carries the data received up to the timeout event, accessible through $Exception->Data().
Setting Brutal to a true value will result in timeouts being ignored, and the gathered data returned without error.
Brutal
$GPIB->timeout( $connection_handle, $timeout );
Sets the timeout in seconds for GPIB operations on the device/connection specified by $connection_handle.
Provides unified access to the fields in initial @_ to all the child classes. E.g.
$GPIB_Address=$instrument->config(gpib_address);
Without arguments, returns a reference to the complete $self->config aka @_ of the constructor.
$config = $bus->config(); $GPIB_PAddress = $bus->config()->{'gpib_address'};
Few. Also, not a lot to be done here.
Lab::Bus
Lab::Bus::MODBUS
and many more...
This software is copyright (c) 2021 by the Lab::Measurement team; in detail:
Copyright 2011 Andreas K. Huettel, Florian Olbrich 2012 Florian Olbrich, Hermann Kraus, Stefan Geissler 2016 Charles Lane, Simon Reinhardt 2017 Andreas K. Huettel 2020 Andreas K. Huettel
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Lab::Measurement, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lab::Measurement
CPAN shell
perl -MCPAN -e shell install Lab::Measurement
For more information on module installation, please visit the detailed CPAN module installation guide.