The GPIB Interface

ONLINE provides functions that support the communication with GPIB (or IEEE 488) devices.

ONLINE> gpib(device) = text_expr
ONLINE> $*$ = gpib(device [[[,length], prompt_string], eos_char])

The first command line writes a string to the GPIB bus, the second reads a string. The meaning of the parameters is:

 device
The GPIB address. For most of the devices this address can be selected with buttons on the front panel. Unfortunatly there are other devices which have to be configured with jumpers. The GPIB address must be unique. It is choosen from {1 ... 31}.

 length
The size of the input buffer, default 50.

 prompt_string
A string that is sent to the device before ONLINE waits for input.

 eos_char
A number , typically 10 or 13 (<lf>, <cr>), which encodes a character that serves as an end-of-string marker. The eos_char is needed only for those devices that do not use END to terminate a message.

Examples:

    Keithley 617: 
      * = gpib( 11,,"F1X")

    Lakeshore DRC-93C8: 
      * = gpib( 15,,"WP")

    TTG-7 Thermometer:                 
      * = gpib( 4,, "L0")

  Lakeshore DRC-91A, PCI-GPIB: 
      * = gpib( 11,, "ws"char(13)""char(10))
        ERR27 K (no input connected)
      * = gpib( 11,, "wp"char(13)""char(10))
        +290.00K
      * = gpib( 11, gpib.out, "xd01"char(13)""char(10))
        Wrote 463 bytes to gpib.out

  Keithley 6485 Picoammeter
      Config/local + Setup + Range -> GPIB + Enter
      Config/local + Comm ADDR: 3 + Enter + LANG: 488.1

      * = gpib(3,,"CONF?")
        CURR:DC
      * = gpib(3,,"READ?")
      -6.632157E-11A,+1.684033E+02,+5.120000E+02

    As a VC: 
     if( $method =~ /read/i)
     {
       gpib_write( 3, "READ?");
       my $buffer = gpib_read(3, 100);
       $buffer =~ /(.+)A.+/;
       return $1; 
     }

SF7210 (VME-GPIB): The driver tests whether an outgoing message ends with <cr> (13) or <lf> (10). If none of these characters is found, the terminating string \015\012\000 is appended.

There is a flag which determines whether a selective-clear is sent to a device when it is touched for the first time in a session:

ONLINE> set gpig_sdc on
ONLINE> set gpig_sdc off default
This feature has been implemented for the 428-Keithleys.



Subsections