ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB programming using c

Hi all,

         I need to program an old tektronix machine using the gpib port.

I have a c application written by someone for it. however on running the application I get an error

libgpib: ibBoardOpen failed to open device file /dev/gpib0
libgpib: No such device or address
libgpib: error in is_cic()!

I installed the ni488.2 driver and ni visa 4.5 on my machine following the link

http://decibel.ni.com/content/docs/DOC-6742#cf

however I was still having the same problem

lsspci -vv

01:09.0 Communication controller: National Instruments PCI-GPIB (rev 02)
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
    Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR+ INTx-
    Latency: 255, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 18
    Region 0: Memory at ff8ff800 (32-bit, non-prefetchable)
    Region 1: Memory at ff8f8000 (32-bit, non-prefetchable) [size=16K]
    Kernel driver in use: ni488

cat /etc/gpib.conf
/***********************************************************************
                 GPIB.CONF IEEE488 library config file
                             -------------------

   copyright            : (C) 2002 by Frank Mori Hess
                          (C) 1994 by C.Schroeter
   email                : fmhess@users.sourceforge.net
***************************************************************************/
/***************************************************************************
*   
*   Syntax:
*
*         interface { ... } starts new interface board section
*         device {...} device configuration
*
***************************************************************************/

/* This section configures the configurable driver characteristics
* for an interface board, such as board address, and interrupt level.
* minor = 0 configures /dev/gpib0, minor = 1 configures /dev/gpib1, etc.
*/

interface {
    minor = 0    /* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */
    board_type = "ni_pci"    /* type of interface board being used */
    name = "violet"    /* optional name, allows you to get a board descriptor using ibfind() */
    pad = 0    /* primary address of interface             */
    sad = 0    /* secondary address of interface           */
    timeout = T3s    /* timeout for commands */

    eos = 0x0a    /* EOS Byte, 0xa is newline and 0xd is carriage return */
    set-reos = yes    /* Terminate read if EOS */
    set-bin = no    /* Compare EOS 8-bit */
    set-xeos = no    /* Assert EOI whenever EOS byte is sent */
    set-eot = yes    /* Assert EOI with last byte on writes */

/* settings for boards that lack plug-n-play capability */
    base = 0    /* Base io ADDRESS                  */
    irq  = 0    /* Interrupt request level */
    dma  = 0    /* DMA channel (zero disables)      */

/* pci_bus and pci_slot can be used to distinguish two pci boards supported by the same driver */
/*    pci_bus = 0 */
/*    pci_slot = 7 */

    master = yes    /* interface board is system controller */
}

/* This is how you might set up a pcIIa board on /dev/gpib1, uncomment to use. */
/*******************
interface {
    minor = 1
    board_type = "pcIIa"
    pad = 0
    sad = 0
    timeout = T3s

    eos = 0x0a
    set-reos = yes
    set-bin = no

    base = 0x2e1
    irq  = 7
    dma  = 1

    master = yes
}
*********************/

/* Now the device sections define the device characteristics for each device.
* These are only used if you want to open the device using ibfind() (instead
* of ibdev() )
*/

device {
    minor = 0    /* minor number for interface board this device is connected to */
    name = "voltmeter"    /* device mnemonic */
    pad = 7    /* The Primary Address */
    sad = 0    /* Secondary Address */

    eos = 0xa    /* EOS Byte */
    set-reos = no /* Terminate read if EOS */
    set-bin = no /* Compare EOS 8-bit */
}

device {
    minor = 0
    name = "scope"
    pad = 8
    sad = 0
}

     Do I need to modify my gpib.conf file?

ls -la /dev |grep gpib
crwxrwxrwx   1 root   gpib    160,   0 2009-09-16 22:48 gpib0
crw-rw----   1 root   gpib    160,   1 2009-09-16 22:48 gpib1
crw-rw----   1 root   gpib    160,  10 2009-09-16 22:48 gpib10
crw-rw----   1 root   gpib    160,  11 2009-09-16 22:48 gpib11
crw-rw----   1 root   gpib    160,  12 2009-09-16 22:48 gpib12
crw-rw----   1 root   gpib    160,  13 2009-09-16 22:48 gpib13
crw-rw----   1 root   gpib    160,  14 2009-09-16 22:48 gpib14
crw-rw----   1 root   gpib    160,  15 2009-09-16 22:48 gpib15
crw-rw----   1 root   gpib    160,   2 2009-09-16 22:48 gpib2
crw-rw----   1 root   gpib    160,   3 2009-09-16 22:48 gpib3
crw-rw----   1 root   gpib    160,   4 2009-09-16 22:48 gpib4
crw-rw----   1 root   gpib    160,   5 2009-09-16 22:48 gpib5
crw-rw----   1 root   gpib    160,   6 2009-09-16 22:48 gpib6
crw-rw----   1 root   gpib    160,   7 2009-09-16 22:48 gpib7
crw-rw----   1 root   gpib    160,   8 2009-09-16 22:48 gpib8
crw-rw----   1 root   gpib    160,   9 2009-09-16 22:48 gpib9

lsmod | grep gpib

gpibprtk              261012  0

nipalk               1404272  8 NiViPciK,nipxirmk,nidimk,niorbk,gpibprtk

And I can see my device when I type visaconf

Am I doing something wrong here? or is my understanding that installing visa can help this C program find my device

also a very basic thing

ibtest fails

ibtest
Do you wish to open a (d)evice or an interface (b)oard?
    (you probably want to open a device): b
enter name of interface board (or device) you wish to open: ni_pci
trying to open board named 'ni_pci'
failed to open board

Pease suggest as to what shoud I do? to

make the ibdev() function to work

0 Kudos
Message 1 of 1
(5,201 Views)