Re: Adding gpib support to Matlab on Linux ?



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.

.



Relevant Pages