gpib_ctypes.gpib package¶
Submodules¶
gpib_ctypes.gpib.constants module¶
gpib_ctypes.gpib.gpib module¶
-
exception
gpib_ctypes.gpib.gpib.
GpibError
(funcname)[source]¶ Bases:
Exception
Exception class with helpful GPIB error messages GpibError(gpib_function_name)
-
gpib_ctypes.gpib.gpib.
ask
(handle, conf)[source]¶ Query configuration by calling ibask.
- Args:
- handle (int): board or device handle conf (int): gpib.Iba* constant designating configuration settings
- Returns:
- int: configuration setting value
-
gpib_ctypes.gpib.gpib.
clear
(handle)[source]¶ Clear device by calling ibclr.
- Args:
- handle (int): device handle
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
close
(handle)[source]¶ Close board or device handle by calling ibonl.
- Args:
- handle (int): board or device handle to close
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
command
(handle, cmd)[source]¶ Write command bytes by calling ibcmd.
- Args:
- handle (int): board handle cmd (bytes): sequence of bytes to write
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
config
(handle, conf, value)[source]¶ Change configuration by calling ibconfig.
- Args:
- handle (int): board or device handle conf (int): gpib.Ibc* constant designating configuration settings value (int): configuration setting value
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
dev
(board, pad, sad=0, tmo=14, sendeoi=1, eos=0)[source]¶ Get a device handle by calling ibdev.
- Args:
- board (int): board number pad (int): primary address sad (int): secondary address, default gpib.NO_SAD tmo (int): timeout constant, default gpib.T30s sendeoi (int): assert EOI on write, default 1 eos (int): end-of-string termination, default 0
- Returns:
- int: board or device handle
-
gpib_ctypes.gpib.gpib.
find
(name)[source]¶ Get a device handle based on a name from configuration file by calling ibfind.
- Args:
- name (string)
- Returns:
- int: board or device handle
-
gpib_ctypes.gpib.gpib.
ibcnt
()[source]¶ Get number of transferred bytes by calling ThreadIbcntl or reading ibcnt.
- Args:
- none
- Returns:
- int: number of transferred bytes
-
gpib_ctypes.gpib.gpib.
ibloc
(handle)[source]¶ Push device to local mode by calling ibloc.
- Args:
- handle (int): device handle
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
ibsta
()[source]¶ Get status value by calling ThreadIbsta or reading ibsta.
- Args:
- none
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
interface_clear
(handle)[source]¶ Clear interface by calling ibsic.
- Args:
- handle (int): board handle
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
lines
(board)[source]¶ Obtain the status of the control and handshaking bus lines of the bus.
- Args:
- board (int): board handle
- Returns:
- int: line capability and status bits
-
gpib_ctypes.gpib.gpib.
listener
(board, pad, sad=0)[source]¶ Check if listener is present at address by calling ibln.
- Args:
- board (int): board or device handle, or board number pad (int): primary address sad (int): secondary address, default gpib.NO_SAD
- Returns:
- bool: True if listener is present, False otherwise
-
gpib_ctypes.gpib.gpib.
read
(handle, length)[source]¶ Read a number of data bytes by calling ibread.
- Args:
- handle (int): board or device handle length (int): number of bytes to read
- Returns:
- bytes: sequence of bytes which was read
-
gpib_ctypes.gpib.gpib.
remote_enable
(handle, enable)[source]¶ Set remote enable by calling ibsre.
- Args:
- handle (int): board handle enable (int): if non-zero, set remote enable
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
serial_poll
(handle)[source]¶ Read status byte by calling ibrsp.
- Args:
- handle (int): device handle
- Returns:
- int: serial poll status byte
-
gpib_ctypes.gpib.gpib.
spoll_bytes
(handle)[source]¶ Get length of status byte queue by calling ibspb.
- Args:
- handle (int): device handle
- Returns:
- int: status byte queue length
-
gpib_ctypes.gpib.gpib.
timeout
(handle, t)[source]¶ Set IO timeout by calling ibtmo.
- Args:
- handle (int): board or device handle t (int): timeout, one of constants from gpib.TNONE to gpib.T100s
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
trigger
(handle)[source]¶ Trigger device by calling ibtrg.
- Args:
- handle (int): device handle
- Returns:
- int: ibsta value
-
gpib_ctypes.gpib.gpib.
version
()[source]¶ Get the GPIB library version. Not implemented on Windows.
- Args:
- none
- Returns:
- str: GPIB library version
-
gpib_ctypes.gpib.gpib.
wait
(handle, eventmask)[source]¶ Wait for event by calling ibwait.
- Args:
- handle (int): board or device handle eventmask (int): ibsta bits designating events to wait for
- Returns:
- int: ibsta value
Module contents¶
Python interface for the linux-gpib library or the NI GPIB C library on Windows and Linux. Adheres to the linux-gpib Python API.
All functions return the value of ibsta except where otherwise specified.