ArticleGPIB

Dernière modification : 2013/05/30 02:01

Carte National Instruments PCI


$ lspci -v
00:05.0 Communication controller: National Instruments PCI-GPIB (rev 01)
        Flags: bus master, medium devsel, latency 64, IRQ 18
        Memory at dffff000 (32-bit, non-prefetchable) [size=2K]
        Memory at dfff8000 (32-bit, non-prefetchable) [size=16K]
        Expansion ROM at dffe0000 [disabled] [size=16K]


Paquets Ubuntu


$ dpkg -l |grep gpib
ii  gpib-modules-source                        3.2.06-3.2ubuntu1                      kernel modules for various GPIB boards
ii  libgpib-bin                                3.2.06-3.2ubuntu1                      libgpib support applications and configurati
ii  libgpib0                                   3.2.06-3.2ubuntu1                      C bindings for GPIB (IEEE 488) kernel driver
ii  libgpib0-dev                               3.2.06-3.2ubuntu1                      C bindings for GPIB (IEEE 488) kernel driver
ii  python-gpib                                3.2.06-3.2ubuntu1                      libgpib python bindings (default package)


gpib-modules-source n'est pas nécessaire car il ne compile pas avec un noyau > 2.6.8.

Install driver

Compilation / installation du driver. La version dispo dans Ubuntu est HS. Télécharger la version 3.2.11

$ cd ~/sources/install/gpib/linux-gpib-3.2.11/
$ ./configure
$ make
$ sudo make install
$ sudo modprobe tnt4882
failed to configure base address
failed to configure board
main: Invalid argument
FATAL: Error running install command for tnt4882


Modifier le fichier /etc/gpib.conf pour ajouter le device et éventuellement la carte :
device {
        minor = 0
        name = "7150plus"
        pad = 16
        sad = 0
}


puis

$ sudo gpib_config


Test du fonctionnement
$ cd examples
sudo ./ibtest
Do you wish to open a (d)evice or an interface (b)oard?
        (you probably want to open a device): d
enter primary gpib address for device you wish to open [0-30]: 16
trying to open pad = 16 on /dev/gpib0 ...
You can:
        w(a)it for an event
        write (c)ommand bytes to bus (system controller only)
        send (d)evice clear (device only)
        change remote (e)nable line (system controller only)
        (g)o to standby (release ATN line, system controller only)
        send (i)nterface clear (system controller only)
        ta(k)e control (assert ATN line, system controller only)
        get bus (l)ine status (board only)
        go to local (m)ode
        change end (o)f transmission configuration
        (q)uit
        (r)ead string
        perform (s)erial poll (device only)
        change (t)imeout on io operations
        request ser(v)ice (board only)
        (w)rite data string
: w
enter a string to send to your device: G
sending string: G

gpib status is:
ibsta = 0x2100  < END CMPL >
iberr= 0

ibcnt = 2
: r
enter maximum number of bytes to read [1024]: 34
trying to read 34 bytes from device...
received string: '+25.65000  DEGC
+25.65000  DEGC
'
Number of bytes read: 34
gpib status is:
ibsta = 0x100  < CMPL >
iberr= 0
ibcnt = 34
: m
Go to local sent.
gpib status is:
ibsta = 0x100  < CMPL >
iberr= 0
: q


Python


Un programme Python qui fait la même chose que ci-dessus :
from Gpib import *
m = Gpib("7150plus")
m.write("G")
print m.read(17)


debian testing (jessie)


aptitude install build-essential linux-headers-`uname -r`
wget linux-gpib-3.2.17.tar.gz
tar xvzf linux-gpib-3.2.17.tar.gz
cd linux-gpib-3.2.17/
./configure
make
# sudo checkinstall -D make install # marche pas :(
sudo make install # y'a des erreurs mais ça semble ok ?