Name

ibterm — Interactive GPIB terminal

Synopsis

ibterm {-d primary_address} [-m minor] [-s secondary_address] [-i eoi] [-e eos] [-r reos] [-b bin] [-x xeos] [-t timeout] [-p prompt] [-f history_file] [-N] [-X] [-h]

Description

An interactive terminal program for sending commands to a device over an IEEE-488 general purpose instrument bus and printing the responses.

Options

-d address

Sets the device's primary address (pad). The address must be between 0 and 30.

-m number

Specify the minor number of the device file this interface board will use. A number of 0 corresponds to /dev/gpib0, 1 is /dev/gpib1, etc. Defaults to 0.

-s address

Sets the device's secondary address (sad). The address must be 0 (disabled) or between 96 and 126 (0x60 and 0x7e hexadecimal). Defaults to 0.

-i 0|1

Assert EIO with last byte sent. Defaults to 1 (true).

-e code

ASCII code of end-of-string (eos) character. The code must be between 0 and 255. Defaults to 0 (no code).

-r 0|1

Terminate read on eos character (reos) flag. Defaults to 0 (false).

-b 0|1

Binary eos character match mode (bin) flag. Defaults to 0 (false).

-x 0|1

Assert EOI when transmitting eos (xeos) flag. Defaults to 0 (false).

-t timeout

Sets the IO timeout for the device. The timeout must be a value from the below table. The default value is 10, corresponding to 300 milliseconds.

timeoutLength
0Never timeout
110 microseconds
230 microseconds
3100 microseconds
4300 microseconds
51 millisecond
63 milliseconds
710 milliseconds
830 milliseconds
9100 milliseconds
10300 milliseconds
111 second
123 seconds
1310 seconds
1430 seconds
15100 seconds
16300 seconds
171000 seconds
-p string

Sets the prompt. Defaults to ibterm>

-f file

Command history file. Defaults to .ibterm_hist_<primary_address>

-N

No automatic read on device, enter return at prompt to read.

-X

Force hexadecimal output.

-h

Print help and exit.

Notes

To quit the program enter the EOF character (Ctrl+D) at the prompt.

For interactivity, timeout should not be greater than 13 i.e. 10 secs.

A device read can always be triggered by hitting enter at the prompt. Interrupting the program while reading from the device may cause hangs.

Implementation details

The program is implemented as follows:

loop:
    Print prompt to stdout
    Read a line of text from stdin
    Write the text (if any) to the device at pad
    If -N is not set, or no text was entered:
        Attempt to read response from the device
        If no response is received before timeout:
            go to loop
        else:
            print the response on stdout
Go back to loop.

See also

See the readline(3) man page for editing input and searching history.