NAME
Device::GPIB::Prologix - Interface to Prologix GPIB-USB Controller
SYNOPSIS
use Device::GPIB::Prologix;
my $d = Device::GPIB::Prologix->new('/dev/ttyUSB0');
$d->send('id?');
my $id = $d->read();
DESCRIPTION
This module provides an OO interface to the Prologix GPIB-USB Controller http://prologix.biz/downloads/PrologixGpibUsbManual-6.0.pdf
It allows you to issue commands and read and write data to and from GPIB devices. The Prologix controller can also act as a device and Device::GPIB::Prologix supports this.
Requires Device::SerialPort.
EXPORT
None by default.
LOW LEVEL FUNCTIONS
- send
-
$d->send($command);
Sends the $command to the currently addressed device.
- read_to_timeout
-
Reads data until a timeout. No interpretation of incoming characters is done.
- read_to_eol
-
Reads data until and EOL character (newline, "\n") is read.
- close
-
Closes the serial port device.
PROLOGIX COMMANDS
- new
-
my $d = Device::GPIB::Prologix->new($port);
Creates a new device instance, connected to the Prologix GPIB-USB Controller via the serial-USB port specified by $port (default '/dev/ttyUSB0').
The Device::GPIB::Prologix object will be automatically destroyed and the serial port closed when the reference goes out of scope.
- read
-
$data = $d->read();
Read data from the addressed instrument until a timeout.
$data = $d->read(1);
Read data from the addressed instrument until EOI or timeout.
- read_binary
-
Reads binary data from the addressed instrument until a timeout expires. The binary data s delivered verbatim, adn can enclude the EOL character.
- version
-
Returns the version string from the Prologix GPIB-USB controller.
- auto
-
Issues the '++auto' command to the PRologix controller, which is not very useful with this package.
- addr
-
Configure or query the current GPIB address of the GPIB controllerusing the '++addr' command.
$ver = $d->addr();
Returns the currently selected GPIB device address.
$d->addr($pad);
Sets the GPIB address of the instrument to be controlled. $pad is an integer between 0 and 30.
$d->addr($pad, $sad);
Sets both the Primary and secondary address of the instrument to be controlled. $pad is an integer between 0 and 30. $sad is an ineger between 96 and 126.
- clr
-
Sends the Selected Device Clear (SDC) message to the currently specified GPIB address.
- eoi
-
$d->eoi($bool;
Enables or disables the assertion of the EOI signal with the last character.
$set = $d->eoi();
Queries whether EOI is enabled or disabled.
- eos
-
$d->eos($val);
Specifies the GPIB termination character, where $val is:
0 Append CR+LF to instrument commands 1 Append CR to instrument commands 2 Append LF to instrument commands 3 Do not append anything to instrument commands
$val = $d->eos();
Queries the current setting of eoi.
- eot_enable
-
$d->eot_enable($bool) Enables or disables the appending of a user specified character (see eot_char) to USB output whenever EOI is detected while reading a character from the GPIB port.
$val = $d->eot_enable();
Queries the current state of eot_enable.
- eot_char
-
$d->eot_char($char);
Specifies the character to be appended to USB output when eot_enable is set to 1 and EOI is detected.
$char = $d->eot_char();
Queries the value of the currently set eot_char.
- ifc
-
$d->ifc();
Asserts GPIB IFC signal for 150 microseconds making Prologix GPIB-USB controller the Controller-In-Charge on the GPIB bus.
- llo
-
$d->llo();
Disables front panel operation of the currently addressed instrument.
- loc
-
$d->loc();
Enables front panel operation of the currently addressed instrument.
- lon
-
$d->lon($bool)
Enables or disables the GPIB-USB controller to listen to all traffic on the GPIB bus, irrespective of the currently specified address (listen-only mode).
$val = $d->lon();
Queries the state of the lon.
- mode
-
$d->mode($val);
Configures the Prologix GPIB-USB controller to be a CONTROLLER or DEVICE, where $val = 1 is CONTROLLER and $val = 2 is DEVICE
$val = $d->mode();
Queries the current value of the mode setting.
- read_tmo_ms
-
$d->read_tmo_ms($val);
specifies the timeout value, in milliseconds, to be used in the read command and spoll command. Timeout may be set to any value between 1 and 3000 milliseconds
- rst
-
$d->rst();
Performs a power-on reset of the controller. The process takes about 5 seconds. All input received over USB during this time are ignored.
- savecfg
-
$d->savecfg($val);
Enables, or disables, automatic saving of configuration parameters in EPROM.
$val = $d->savecfg();
- spoll
-
performs a serial poll of the instrument at the specified address. If no address is specified then this command serial polls the currently addressed instrument.
$d->spoll($pad);
Serial poll instrument at primary address.
$d->spoll($pad, $sad);
Serial poll instrument at primary address and secondary address.
$d->spoll();
Serial poll the currently addressed instrument.
- srq
-
$val= $d->srq();
Returns the current state of the GPIB SRQ signal.
- status
-
$d->status($val);
Specify the device status byte to be returned when serial polled by a GPIB controller.
- trg
-
$d->trg($pad1, $sad1, ......);
issues Group Execute Trigger GPIB command to devices at the specified addresses. Up to 15 addresses maybe specified.
SEE ALSO
EXAMPLES
A number ofsample programs are provided in bin which may be useful in their own right. They will be installed into your perl script diorectory if you 'make install'.
tekscreendump.pl
Make a screendump from a Tek TDS-220 or similar scope tekscreendump.pl -address 1 >/tmp/x.bmp
dm5110.pl
Read values continuously from a Tektronix DM5110. dm5110.pl -address 22
AUTHOR
Mike McCauley, <mikem@airspayce.com>
COPYRIGHT AND LICENSE
Copyright (C) 2015 by Mike McCauley
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.1 or, at your option, any later version of Perl 5 you may have available.