Gpib

Linux Gpib Howto in Gentoo
linux-gpib with python flags is using python 2.7

Installing linux-gpib
First set use flags in /etc/portage/package.use sudo vim /etc/portage/package.use

add line for python bindings and Documentation sci-libs/linux-gpib python doc Other possible Flags pcmcia static debug guile perl php tcl firmware If you want to use pcmia you need to have a 2.7 kernel. But pcmia  is normally just used in old computers so it doesn't matter.

Install it with emerge -a sci-libs/linux-gpib Add your user to gpib group gpasswd -a user gpib

Configuring linux-gpib
To configure Linux GPIB you need first to create a config file at /etc/gpib.conf vim /etc/gpib.conf

Just an example which is for NI USB- HS Adapter is:

interface { minor = 0 board_type = "ni_usb_b" name = "joe" pad = 0 master = yes }

You can lookup the board_type at Linux-gpib-Website

There is an example config file with more parameters on GPIB-Linux Website

After you wrote your own config file, you have to plug in your GPIB Device and either first chgrp the gpib Devices in /dev/ and make them write and readable chgrp gpib /dev/gpib* chmod g+wr /dev/gpib*

or do all things as root.

After doing that you should be able to call with root /usr/sbin/gpib_config -m 0 0 is the device you plugged in.

Example Python
Be carefull linux-gpib cames with python2.7 bindings so first start python2.7 python2.7

This example is tested with a HP8720D

To import gpib: import gpib To get a device of a board named in /etc/gpib.conf joe: con=gpib.dev(0,16) 0 is the GPIB BOARD and 16 the Adress of the Listener To write a command: gpib.write(con,'STAR2400MHZ;')

To read the result: gbip.read(con,1000) 1000 is the Number of byte that are read