LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-10-2013, 05:26 AM   #1
B Akshay
Member
 
Registered: Sep 2012
Posts: 39

Rep: Reputation: Disabled
Information for Controlling Devices using GPIB in Linux/Cygwin/Python


Hello,
I wish to control a Agilent Techs DC power source. I have NI's PCI-GPIB card.
I am new to the GPIB programming and need some guidance.
  • The controlling has to be done by using cygwin.(will the purpose be fulfilled??)
  • After searching on net thinking to have scripts in python, but pyvisa is not present on cygwin.(Is python a good choice?? Suggest for any other programming language)
  • is Linux-GPIB scripts required??(How to add to cygwin?)

I am just a beginner in this field, any suggestions for the above mentioned will be helpful.

Thanks in advance
 
Old 01-10-2013, 07:06 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Cygwin is not Linux. The Linux-GPIB driver package is mostly a collection of Linux device drivers (building requires Linux kernel headers) and API library as well as a bit of example source code that exercises the drivers and demonstrates how to communicate with your GPIB instrument.
I'm not a Windows person at all, but from what I know, I don't think you could have chosen a more difficult environment in which to use GPIB. NI does (did, at least) have a layer they called 'Visa', and I had some success using that on Solaris with an ethernet attached GPIB interface. That would be the first thing I'd look for in your situation.

--- rod.
 
Old 01-10-2013, 10:33 PM   #3
B Akshay
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Rod, Thanks for your response

so according to you, controlling the device from the cygwin will be a tedious job.

Will it be good to use python for scripts??
So that, i can directly use ActivePython for windows which support for the VISA module. (Again a newbie to python)
I am searching more for, programming and support for the VISA and GPIB in python.


Regards,
Akshay
 
Old 01-11-2013, 08:50 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Yes, that is potentially correct. The existence of a Visa library may be the savior in that architecture.

The usual method (at least in Linux; don't know about Windows) is that an OS-specific kernel driver provides access to the bus. Above that, a shareable object library (probably a DLL, in Windows) exposes a common API (Visa, or the Linux-GPIB API, which is modeled after the NI API) for accessing the bus/device from userspace. Multiple language bindings to the API can then exist, and I would guess that Python is probably included in those language bindings.

If you have the option of using a real Linux host, your job may be easier (definitely easier than using Cygwin), and you will certainly find more help here and at other online sites. For Windows, your best resource is probably the NI site, which I think has a forum similar to this one.

--- rod.
 
Old 01-12-2013, 07:45 AM   #5
B Akshay
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Thanks for the information rod !!!
I am tracking the same.

Will try to do the setup using Linux machine.
 
Old 01-16-2013, 02:57 AM   #6
B Akshay
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Hello Rod,
I was just trying with the linux part of it. But confused, how to initiate with script.
Can you please provide me a small sample code using Gpib-utils or Linux-Gpib ?

Thanks & Regards,
B Akshay
 
Old 01-16-2013, 08:39 AM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
If you built and installed the Linux-GPIB drivers, then there will be some sample code there. The ibtest utility that is part of the package is very useful for making sure that you've got the driver correctly loaded and installed. It allows you to interactively send commands to devices attached to the bus, as well as configure the bus itself. I have used the source code for that as a model for some basic test and development code in some projects. There is other source code samples in the 'language/' tree of the driver package.
There is a tool, ibconfig, that must be run before you can use the loaded driver. After that, everything should work.I usually put the ibconfig step into /etc/rc.local so it runs at boot time. You may have to also modify the permission levels on the device node(s) /dev/gpip* in order to access the bus. The only problem I've ever had with the package is that some of the drivers don't always build for all kernel versions, but the NI board drivers have always built and worked fine. If you run into that, then comment out the recalcitrant ones in the appropriate Makefile, so the build completes successfully.
One aspect that may warrant further clarification is the use of the gpib.conf file that is used by ibconfig. In there, you can created named devices that are associated with particular GPIB bus addresses and with some GPIB configuration parameters like time-outs, etc. These are only necessary if your code uses the API functions that need these named devices. There is a whole class of name-agnostic functions which rely only on device names (/dev/gpibX) and GPIB addresses. I tend to prefer these over the fucntions that use the named devices set up in the config file (not saying there is anything wrong with the others; just haven't used them much). I think the sample code tends to use the API functions that do use the named devices.
If you have a NI GPIB interface, it probably came with some DOS-ish software and libraries. The documentation for those libraries is also a useful guide, as the Linux-GPIB package models the API after NI's version, and seems to be a pretty faithful rendition of the NI software.
The software does work well. I've got a dozen or so installations that run 24/7 controlling a variety of T&M gear, all problem free, and some that has been doing so for over ten years. I have been using Scientific Linux (4,5, & 6), and more recently a Debian-6 based package for both building the software and running applications. I only today became aware of the gpib-utils package, so I cannot offer any comment on that product.

--- rod.

Last edited by theNbomr; 01-16-2013 at 08:44 AM.
 
Old 02-05-2013, 05:54 AM   #8
B Akshay
Member
 
Registered: Sep 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Thanks alot!!!
I have gone through the site.. It helped me a lot.
Simultaneously i searched for the pyVisa in python, i have installed it successfully on my system.
I have programmed my device as well and is working fine.
Will carry on with the GPIB programming on Linux also.

Regards,
B Akshay
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NI PCI-GPIB doesn't work with linux-gpib-3.2.11 under Suse 10 Weining Linux - Hardware 1 09-18-2009 03:18 AM
[SOLVED] NI AT-GPIB ISA card with linux-GPIB 3.2.11 driver: failed to allocate ioports bluefan Linux - Hardware 13 08-19-2009 10:06 AM
help me -> c++ and linux in controlling hardware devices jaepi Linux - Newbie 5 05-02-2007 06:04 AM
configuring linux-gpib for pcmcia-gpib card Calibus Linux - Hardware 0 03-21-2006 07:07 AM
obtaining information about controlling devices infamous41md Programming 2 03-07-2004 12:24 PM


All times are GMT -5. The time now is 06:04 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration