LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get LabView to control GPIB on Linux?

Hi,
I am running Gentoo Linux on a x86-based machine with a National Instruments PCI-GPIB card and kernel 2.6.8 (the newest that would still allow the NI-488.2 Drivers to compile).

I have LabView 7.0 running fine, and the GPIB drivers also are working fine (the card passes gpibtsw and  I can send commands to a device using gpibintctrl).  However, I can't get the GPIB 488/488.2 functions in LabView to communicate with the GPIB card.  I run a VI and it executes in almost no time, without communicating with anything. 

I would think it is a problem with Labview using the wrong library of GPIB functions, but that's just a guess.

Any ideas?

Thanks,
Kasey
0 Kudos
Message 1 of 7
(3,225 Views)
Kasey,

That is great that you got the driver to install in Gentoo.  Did you try using the VISA VIs, or the NI-488.2 VIs, or both?  I am guessing that you first installed the NI-488.2 Driver, then LabVIEW.  When you install the NI-488.2 driver it checks for a LabVIEW installation before adding the LabVIEW support.  I would recommend uninstalling NI-488.2 and NI-VISA, and reinstalling them.  This should fix the problem.

If that doesn't solve the problem, or if I am wrong about the order you installed things let me know.  Like you said it is probabaly just looking in the wrong place for the GPIB Library, but I'd have to look into where this information is stored.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
Message 2 of 7
(3,207 Views)
Hi Shawn,
Thanks for the reply.  In case anyone is interested in installing on Gentoo, there were two issues that I got around: kernels newer than 2.6.8 have modified/deleted two functions (well, one in 2.6.9, another in 2.6.11 or so) that nikal.c needed.  I'm sorry I didn't write down the names for you, but they are pretty obvious errors when you try to compile.  I initially hacked nikal.c until it compiled with a 2.6.12 kernel, but then the install would fail after compile because it was unable to "Start Ni-Kal" (or something similar; I forget exactly). 

At that point I downgraded to kernel 2.6.8, which compiled fine but needed RedHat-style runlevel directories like /etc/rc0.d to finish the installation.  I had to create the directories (rc0.d thru rc6.d) to get the scripts to copy, and then I modified the system services scripts for gpibenumsvc and nipal to work with Gentoo.  This wasn't much of a hassle; I commented a lot of stuff out, switched the first line to #!/sbin/runscript, put 'start-stop-daemon --start --exec' in front of any commands I found in the start() section of the scripts, and replaced 'exit' with 'eend'.

At this point, I could communicate with external devices using the command-line programs that came with the driver, so I knew the card was working. 

I installed LabView before the drivers, but when it didn't work I then reinstalled LabView to see if that would help.  I did try both the VISA VIs and the NI-488.2 VIs at various points, but mostly I played with the 488.2 VIs since that is what all my current VIs are written to use.

I needed to get this running today, so I downloaded sources for kernel 2.4.31 and got that working.  The LabView7.0 install CD includes drivers that work with the 2.4 kernel, so that install went fine and everything is up and running.  I would have preferred to use kernel 2.6, but I am happy to at least have Gentoo on this machine now. 

When I get time, I'll try the 2.6.8 kernel again and let you know if I get it working.  How does the driver add LabView support?  I saw that it put libraries libgpibapi.so.2, libgpibconf.so.2, and liblvgpibconf.so.2 in /usr/local/lib, but I couldn't figure out if LabView knew to look there for them (or if they were even the right libraries).

Thanks for your time.  Sorry for the flood of information; I thought it might be useful if you or someone else is trying to get PCI-GPIB to work with LabView on Gentoo.
-kasey
0 Kudos
Message 3 of 7
(3,197 Views)

Kasey,

As far as I know, LabVIEW will try to load /usr/local/lib/libgpibapi.so or maybe libgpibapi.so.2 to make calls into the GPIB driver.  This should be a link ultimately to /usr/local/natinst/ni4882/lib/libgpibapi.so.2.3.1.  Make sure that all those links and that files exist.  Also, you might try running LabVIEW through strace to see which libgpibapi.so it's trying to open and then verify that that's actually there.  "strace -o mylog.log labview".

Let us know.

Scott B.
GPIB Software
National Instruments

Message 4 of 7
(3,187 Views)
Hi!
I'm trying to get working a 6250 on a Gentoo Box. Anyway I had some problems with the install script. I followed your suggestions modifying the scripts and creating /etc/rc* too. I can modprobe nikal and nipal modules, creating something in /dev/ni* but no luck when I run lsdaq. I made a very dirty installation. If you can post me your modified scripts it would be a great help.

In any case thanks a lot for the previous suggestions!
0 Kudos
Message 5 of 7
(3,134 Views)
Hi,
I'm sorry to say that I didn't think to save the scripts before I wiped them and went with kernel 2.4.  I didn't do anything fancy, though, so if you follow the recommendations in the initscripts section of the Gentoo Handbook you should get an idea of what you need:
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4
I also peeked at the other initscripts in the init.d directory for some hints.  gpm, for one, is a pretty simple example.  If I recall correctly, the scripts you are modifying declare a lot of variable names for the different functions (start, stop, etc.) and then have a case structure at the bottom to associate them with the desired action.  I'm not sure if it is necessary, but I commented out all of the case structure and all of the functions except for 'start.'  Then I changed the name of that function from
StartService ()
(or whatever it was) to
start ()
to match the Gentoo requirements. Then change the first line from #!/bin/bash to #!/sbin/runscript and comment out the 'exit' command at the bottom.  The command within the 'start' function might also need to be changed to
start-stop-daemon --start --quiet --exec /path/to/my_service
I can't recall anything else that I did.  I hope that helps.
Cheers,
Kasey
0 Kudos
Message 6 of 7
(3,126 Views)
Today I'm feel lucky because I installed all the rpm packages of the nidaqmx-base by hand with that commands after extracting the NICVISA_.TZ

# history
    cd nikal/
    rpm -i --nodeps --force nikali-1.0.1-f0.i386.rpm
    cd ../
    cd nipal/
    rpm -i --nodeps --force nipali-1.9.1-f0.i386.rpm
    cd ..
    rpm -i --nodeps --force nivisa-3.3.0-f3.i386.rpm
    rpm -i --nodeps --force nivisaserver-3.3.0-f3.i386.rpm
    rpm -i --nodeps --force nicvirte-5.0.1-3.i386.rpm
    cd ..
    rpm -i --nodeps --force nidaqmxbase-board-support-1.5.0-f2.i386.rpm
    rpm -i --nodeps --force nidaqmxbase-cinterface-1.5.0-f2.i386.rpm
    rpm -i --nodeps --force nidaqmxbase-labview7
    rpm -i --nodeps --force nidaqmxbase-labview71-VIs-1.5.0-f2.i386.rpm
    rpm -i --nodeps --force labview70-rte-7.0-3.i386.rpm

all worked fine and then...

# lsdaq
--------------------------------
Detecting National Instruments DAQ Devices
Found the following DAQ Devices:
NI 6250:     "Dev1"    (PXI0::10::INSTR)
--------------------------------

Happyness! 🙂

Am not an expert rpm user but I feel that am on the right way. Tomorrow I will start working the acquisitions and I will know if it works fine.

Many thanks you for the reply.
0 Kudos
Message 7 of 7
(3,115 Views)