NAME
Lab::Moose::Connection::LinuxGPIB - Connection back end to the LinuxGpib library and kernel drivers
VERSION
version 3.730
SYNOPSIS
use Lab::Moose
my $instrument = instrument(
type => 'random_instrument',
connection_type => 'LinuxGPIB',
# use primary address '1' and no secondary addressing.
connection_options => {pad => 1, timeout => 3},
);
DESCRIPTION
This module provides a connection interface to Linux-GPIB. See Lab::Measurement::Backends for more information on Linux-GPIB and its Perl backend.
METHODS
new
The constructor takes the following attributes. The only required attribute is pad.
pad (or gpib_address for backwards compatibility with Lab::Connection::LinuxGPIB)
Primary address of the device. Required.
sad
Secondary address of the device. Default is 0 (Do not use secondary addressing). Valid values are ( 96 .. 126 ).
board_index
Board index as provided in your /etc/gpib.conf. Default is 0.
timeout
Connection timeout in seconds. Default is 1. LinuxGPIB provides the following timeout values. The value given to the constructor will be rounded upwards to a valid timeout.
0 (never timeout)
10e-6
30e-6
100e-6
300e-6
1e-3
3e-3
10e-3
30e-3
100e-3
300e-3
1
3
10
30
100
300
1000
METHODS
All methods croak if they take longer than the timeout.
The 'timeout' argument is always optional. If given, this overrides the connection's timeout attribute.
Read
my $data = $connection->Read();
Call ibread on the connection. Read an arbitrary amount of data until the 'END' bit is set in ibsta
. Croak on read errors.
The read may requires multiple calls to ibrd. In this case, it will still croak if the total time of operation does not exceed the timeout.
Write
$connection->Write(command => "*CLS");
Takes one mandatory argument 'command'. Write this string to the connection. Croak on write error.
Clear
$connection->Clear();
Call device clear (ibclr) on the connection.
set_termchar
$connection->set_termchar(termchar => "\r");
Set the end-of-string byte
enable_read_termchar
$connection->enable_read_termchar();
Enable termination of reads when eos character is received.
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by the Lab::Measurement team; in detail:
Copyright 2016 Simon Reinhardt
2017 Andreas K. Huettel, Simon Reinhardt
2019 Simon Reinhardt
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.