Re: Adding gpib support to Matlab on Linux ?
- From: Tom Davis <tomldavis@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 05 Feb 2006 11:42:38 -0600
Madhusudan,
ugpib.h is the include file provided by NI for the Sun driver that they
provide. Each platform has a unique include file (contents and name).
For linux-gpib, the file is lib/ib.h in their distribution.
Use that include file in my source instead of ugpib.h.
Here's how I would do it: Make a copy of one of my platform directories,
say Unix and name it Linux. Edit gpib.h in that directory to include ib.h
instead of ugpib.h.
Also, note that not all API calls are supported on all platforms. I address
this in gpib.h by defining unsupported calls as NOSUPPORT. I'm guessing
linux-gpib will have its own set of unsupported calls.
Remember, I'm just guessing this will work. I don't have a linux box
to test it on.
If you get it working, it would be nice to let the linux-gpib team and
me know.
Good luck,
Tom
In article <ToednTE_EIClYXnenZ2dnUVZ_s2dnZ2d@xxxxxxxxxxx>,
Madhusudan Singh <spammers-go-here@xxxxxxxxxxxx> wrote:
Tom Davis wrote:.
If the linux drivers support the NI-488 C API (and it looks like they do),
you might want to try MATLAB Central File Exchange and search for gpib.
From the description:
Communicate with lab equipment from MATLAB using GPIB commands. This
package contains the C source for a MEX-file that provides an interface
to National Instruments GPIB board using NI-488M functions. This is
version 2.1 which has added features and support for Mac, Unix and
Windows platforms. Pre-built MEX-files for PowerMac, Windows NT and
SunOS are included.
Tom
Thanks for your response. I tried this on my Linux system, but I think I
need some modifications :
Contents of /usr/local/linux-gpib/include/gpib :
$ ls /usr/local/linux-gpib/include/gpib/
gpib_user.h ib.h
Now, I cannot find any file named ugpib.h on my system. Perhaps that is
specific to Sun OS. Could you indicate what it contains, and if I could
replace all references to it in gpib.c with gpib_user.h ?
I found a message that indicates that that might be the thing to do :
http://www.llp.fu-berlin.de/new-lists/llp/msg00466.html
I executed the following in the root directory of the unpacked distribution
after modifying the header file in Unix :
#define UNIX^M
#include "/usr/local/linux-gpib/include/gpib/gpib_user.h" /*
part
of National Instruments GPIB distribution */^M
$ mex gpib.c /usr/local/linux-gpib/lib/libgpib.so -I./Unix
-I /usr/local/linux-gpib/include/gpib/
gpib.c:19:17: error: mex.h: No such file or directory
In file included from ./Unix/gpib.h:2,
from gpib.c:20:
/usr/local/linux-gpib/include/gpib/gpib_user.h:195: error: syntax error
before 'MLA'
/usr/local/linux-gpib/include/gpib/gpib_user.h:200: error: syntax error
before 'MTA'
/usr/local/linux-gpib/include/gpib/gpib_user.h:205: error: syntax error
before 'MSA'
/usr/local/linux-gpib/include/gpib/gpib_user.h:210: error: syntax error
before 'PPE_byte'
/usr/local/linux-gpib/include/gpib/gpib_user.h: In function 'PPE_byte':
/usr/local/linux-gpib/include/gpib/gpib_user.h:212: error: 'uint8_t'
undeclared (first use in this function)
/usr/local/linux-gpib/include/gpib/gpib_user.h:212: error: (Each undeclared
identifier is reported only once
/usr/local/linux-gpib/include/gpib/gpib_user.h:212: error: for each function
it appears in.)
/usr/local/linux-gpib/include/gpib/gpib_user.h:212: error: syntax error
before 'cmd'
/usr/local/linux-gpib/include/gpib/gpib_user.h:214: error: 'cmd' undeclared
(first use in this function)
gpib.c: At top level:
gpib.c:76: error: syntax error before '*' token
gpib.c:143: error: syntax error before 'Matrix'
gpib.c: In function 'mexFunction':
gpib.c:166: error: 'nrhs' undeclared (first use in this function)
gpib.c:169: error: 'prhs' undeclared (first use in this function)
gpib.c:189: error: 'nlhs' undeclared (first use in this function)
gpib.c:218: error: 'plhs' undeclared (first use in this function)
gpib.c:218: error: 'REAL' undeclared (first use in this function)
gpib.c:219: warning: assignment makes pointer from integer without a cast
gpib.c:269: warning: assignment makes pointer from integer without a cast
gpib.c:293: warning: assignment makes pointer from integer without a cast
gpib.c:300: warning: assignment makes pointer from integer without a cast
gpib.c:330: error: 'ibcnt' undeclared (first use in this function)
gpib.c:344: warning: assignment makes pointer from integer without a cast
gpib.c:356: warning: assignment makes pointer from integer without a cast
gpib.c:372: warning: assignment makes pointer from integer without a cast
gpib.c:383: warning: assignment makes pointer from integer without a cast
gpib.c:446: error: 'iberr' undeclared (first use in this function)
gpib.c:447: error: 'ibsta' undeclared (first use in this function)
gpib.c:464: warning: assignment makes pointer from integer without a cast
gpib.c: In function 'gpiberr':
gpib.c:488: error: 'ibsta' undeclared (first use in this function)
gpib.c:506: error: 'iberr' undeclared (first use in this function)
gpib.c:522: error: 'ibcnt' undeclared (first use in this function)
gpib.c: At top level:
gpib.c:532: error: syntax error before '*' token
gpib.c: In function 'getString':
gpib.c:534: error: 'ptr' undeclared (first use in this function)
gpib.c:544: error: 'str' undeclared (first use in this function)
mex: compile of 'gpib.c' failed.
- Follow-Ups:
- Re: Adding gpib support to Matlab on Linux ?
- From: Madhusudan Singh
- Re: Adding gpib support to Matlab on Linux ?
- References:
- Re: Adding gpib support to Matlab on Linux ?
- From: Madhusudan Singh
- Re: Adding gpib support to Matlab on Linux ?
- Prev by Date: Re: Excel Link - Running Matlab Command in Visual Basic
- Next by Date: Re: Image pixel coordinates
- Previous by thread: Re: Adding gpib support to Matlab on Linux ?
- Next by thread: Re: Adding gpib support to Matlab on Linux ?
- Index(es):
Relevant Pages
|