From: Rafal on 3 Mar 2007 09:46 I have similar communication problem via NI GPIB-USB-HS with GPIB devices... Can anybody help? Rafal Chun-Yen Cheng wrote: > > > After some trial & error, we found: > > (1) LeCroy 8901a can reponse to the GPIB Matlab Toolbox from <http://www.alamath.com/gpib.html>. > nd, using NI-488.2 utility program --- NI spy, we can monitor the > response of 488.2's commands. > > However, it has some bug somehow ! By the following program, we can > successfully open, initialize, set transfer mode, and write command > word to LeCroy 8901a. > > But, whenever, any of the 8-bit bytes of 24-bit word exceed 126 > (d1, > or d2, or d3), CAMAC response went wrong !! > > % --- Sample Code to initiate & write --- % > global gpibBd Device; > global pcTalk pcListen pcStandby; > global qx_Return; qx_Return = 0; > > gpibBd = 0; addr = 3; sub_addr = 0; % LeCroy 8901a > pcTalk = char([64, 32 + addr]); > pcListen = char([32, 64 + addr]); > pcStandby = char([63, 95]); > > Device = ibdev(gpibBd,addr,sub_addr,7,0,0); % open 8901a > ibrsc(gpibBd, 1); ibtmo(gpibBd,12); > ibsic(gpibBd); ibtmo(gpibBd,12); % clear GPIB interface > ibclr(Device); ibtmo(gpibBd,12); % clear GPIB device > > ibcmd(gpibBd, pcTalk, 2); > ibwrt(Device, char(100), 1); % 24 bit normal mode > ibcmd(gpibBd, pcStandby, 2); > > ibcmd(gpibBd, pcTalk, 2); > ibwrt(Device, char(33), 1); % initialize CAMAC > ibcmd(gpibBd, pcListen, 2); > > ibcmd(gpibBd, pcTalk, 2); > ibwrt(gpibBd, char(72), 1); % inhibit CAMAC > ibcmd(gpibBd, pcListen, 2); > > ibcmd(gpibBd, pcTalk, 2); > ibwrt(Device, char(100), 1); % 24 bit normal mode > ibcmd(gpibBd, pcStandby, 2); > > d1 = 1; % first byte of data (24-bit word) > d2 = 1; % second byte of data (24-bit word) > d3 = 1; % third byte of data (24-bit word) > rw = char( [16 0 16 d1 d2 d3] ); % data for test > ibcmd(gpibBd, pcTalk, 2); > ibwrt(gpibBd, rw, 6) % write command & data > ibcmd(gpibBd, pcListen, 2); > > ibonl(Device,0); % close 8901a > % --- End of Sample Code --- % > > It seems we have to find some other way to send data byte by byte, > because the ascii has range of about 126 ? > How can we send them in binary way ? > > (2) On the other way to talk to 8901a, we try the followig: > > %% ------------------------------------ %% > > gpibBd = 0; addr = 3; sub_addr = 0; % LeCroy 8901a > pcTalk = char([64, 32 + addr]); > pcListen = char([32, 64 + addr]); > pcStandby = char([63, 95]); > > g = visa('ni', 'GPIB0::3::0::INSTR'); > fopen(g); > > fprintf(g,pcTalk) > fprintf(g,char(100)) > fprintf(g,pcListen) > > fprintf(g,pcTalk) > fprintf(g,char(33)) > fprintf(g,pcListen) > > fclose(g); > delete(g); > > %% ------------------------------------ %% > > However, nothing happen .... > > So, we post the issue here, and wish some help ... > > CY Cheng
From: Ankit Desai on 3 Mar 2007 12:08 On Mar 3, 9:46 am, Rafal <rszu...(a)ire.pw.edu.pl> wrote: > I have similar communication problem via NIGPIB-USB-HS withGPIB > devices... > Can anybody help? > > Rafal > > Chun-Yen Cheng wrote: > > > After some trial & error, we found: > > > (1) LeCroy 8901a can reponse to theGPIBMatlab Toolbox from <http://www.alamath.com/gpib.html>. > > nd, using NI-488.2 utility program --- NI spy, we can monitor the > > response of 488.2's commands. > > > However, it has some bug somehow ! By the following program, we can > > successfully open, initialize, set transfer mode, and write command > > word to LeCroy 8901a. > > > But, whenever, any of the 8-bit bytes of 24-bit word exceed 126 > > (d1, > > or d2, or d3), CAMAC response went wrong !! > > > % --- Sample Code to initiate & write --- % > > global gpibBd Device; > > global pcTalk pcListen pcStandby; > > global qx_Return; qx_Return = 0; > > > gpibBd = 0; addr = 3; sub_addr = 0; % LeCroy 8901a > > pcTalk = char([64, 32 + addr]); > > pcListen = char([32, 64 + addr]); > > pcStandby = char([63, 95]); > > > Device = ibdev(gpibBd,addr,sub_addr,7,0,0); % open 8901a > > ibrsc(gpibBd, 1); ibtmo(gpibBd,12); > > ibsic(gpibBd); ibtmo(gpibBd,12); % clearGPIBinterface > > ibclr(Device); ibtmo(gpibBd,12); % clearGPIBdevice > > > ibcmd(gpibBd, pcTalk, 2); > > ibwrt(Device, char(100), 1); % 24 bit normal mode > > ibcmd(gpibBd, pcStandby, 2); > > > ibcmd(gpibBd, pcTalk, 2); > > ibwrt(Device, char(33), 1); % initialize CAMAC > > ibcmd(gpibBd, pcListen, 2); > > > ibcmd(gpibBd, pcTalk, 2); > > ibwrt(gpibBd, char(72), 1); % inhibit CAMAC > > ibcmd(gpibBd, pcListen, 2); > > > ibcmd(gpibBd, pcTalk, 2); > > ibwrt(Device, char(100), 1); % 24 bit normal mode > > ibcmd(gpibBd, pcStandby, 2); > > > d1 = 1; % first byte of data (24-bit word) > > d2 = 1; % second byte of data (24-bit word) > > d3 = 1; % third byte of data (24-bit word) > > rw = char( [16 0 16 d1 d2 d3] ); % data for test > > ibcmd(gpibBd, pcTalk, 2); > > ibwrt(gpibBd, rw, 6) % write command & data > > ibcmd(gpibBd, pcListen, 2); > > > ibonl(Device,0); % close 8901a > > % --- End of Sample Code --- % > > > It seems we have to find some other way to send data byte by byte, > > because the ascii has range of about 126 ? > > How can we send them in binary way ? > > > (2) On the other way to talk to 8901a, we try the followig: > > > %% ------------------------------------ %% > > > gpibBd = 0; addr = 3; sub_addr = 0; % LeCroy 8901a > > pcTalk = char([64, 32 + addr]); > > pcListen = char([32, 64 + addr]); > > pcStandby = char([63, 95]); > > > g =visa('ni', 'GPIB0::3::0::INSTR'); > > fopen(g); > > > fprintf(g,pcTalk) > > fprintf(g,char(100)) > > fprintf(g,pcListen) > > > fprintf(g,pcTalk) > > fprintf(g,char(33)) > > fprintf(g,pcListen) > > > fclose(g); > > delete(g); > > > %% ------------------------------------ %% > > > However, nothing happen .... > > > So, we post the issue here, and wish some help ... > > > CY Cheng I would recommend Instrument Control Toolbox for the task. For controlling the instrument using GPIB object, check the following link: http://www.mathworks.com/access/helpdesk/help/toolbox/instrument/f13-5310.html You can also try to communicate using device object. http://www.mathworks.com/access/helpdesk/help/toolbox/instrument/f6-1007240.html Instrument Control Toolbox provides driver for LeCroy 8600a that can be used to communicate via TCPIP. You can try using that driver for this instrument or modify the driver using 'midedit' function to suite the needs. Hope this helps, -Ankit
From: Rafal on 7 Mar 2007 08:40 ok, finally I solved the problem. There is no problem with using GPIB-USB-HS NI interface with Matlab. In my case: - It was need to install WinXP SP2 on my laptop (this SP include some supprt for HS USB), - There is no problem with Matlab 6.5 (but I had problems with Matlab 7 - there was some info about problems with drivers) - standard commands (like for PCI GPIB cards) a=gpib('ni',0,20); (where: 0 - board index - you can see it in the included software by NI; 20 - address of my VNA), next like in Matlab manual: g = gpib('ni',0,20); fopen(g); fprintf(g,'*IDN?'); idn = fscanf(g); fclose(g); You do not need any additional packages. So,... 'NI GPIB-USB-HS' + notebook + Matlab = very nice and powerful tool for mobile measurements. Rafal Rafal wrote: > > > I have similar communication problem via NI GPIB-USB-HS with GPIB > devices... > Can anybody help? > > Rafal > > Chun-Yen Cheng wrote: >> >> >> After some trial & error, we found: >> >> (1) LeCroy 8901a can reponse to the GPIB Matlab Toolbox from <http://www.alamath.com/gpib.html>. >> nd, using NI-488.2 utility program --- NI spy, we can monitor the >> response of 488.2's commands. >> >> However, it has some bug somehow ! By the following program, we > can >> successfully open, initialize, set transfer mode, and write > command >> word to LeCroy 8901a. >> >> But, whenever, any of the 8-bit bytes of 24-bit word exceed 126 >> (d1, >> or d2, or d3), CAMAC response went wrong !! >> >> % --- Sample Code to initiate & write --- % >> global gpibBd Device; >> global pcTalk pcListen pcStandby; >> global qx_Return; qx_Return = 0; >> >> gpibBd = 0; addr = 3; sub_addr = 0; % LeCroy 8901a >> pcTalk = char([64, 32 + addr]); >> pcListen = char([32, 64 + addr]); >> pcStandby = char([63, 95]); >> >> Device = ibdev(gpibBd,addr,sub_addr,7,0,0); % open 8901a >> ibrsc(gpibBd, 1); ibtmo(gpibBd,12); >> ibsic(gpibBd); ibtmo(gpibBd,12); % clear GPIB interface >> ibclr(Device); ibtmo(gpibBd,12); % clear GPIB device >> >> ibcmd(gpibBd, pcTalk, 2); >> ibwrt(Device, char(100), 1); % 24 bit normal mode >> ibcmd(gpibBd, pcStandby, 2); >> >> ibcmd(gpibBd, pcTalk, 2); >> ibwrt(Device, char(33), 1); % initialize CAMAC >> ibcmd(gpibBd, pcListen, 2); >> >> ibcmd(gpibBd, pcTalk, 2); >> ibwrt(gpibBd, char(72), 1); % inhibit CAMAC >> ibcmd(gpibBd, pcListen, 2); >> >> ibcmd(gpibBd, pcTalk, 2); >> ibwrt(Device, char(100), 1); % 24 bit normal mode >> ibcmd(gpibBd, pcStandby, 2); >> >> d1 = 1; % first byte of data (24-bit word) >> d2 = 1; % second byte of data (24-bit word) >> d3 = 1; % third byte of data (24-bit word) >> rw = char( [16 0 16 d1 d2 d3] ); % data for test >> ibcmd(gpibBd, pcTalk, 2); >> ibwrt(gpibBd, rw, 6) % write command & data >> ibcmd(gpibBd, pcListen, 2); >> >> ibonl(Device,0); % close 8901a >> % --- End of Sample Code --- % >> >> It seems we have to find some other way to send data byte by > byte, >> because the ascii has range of about 126 ? >> How can we send them in binary way ? >> >> (2) On the other way to talk to 8901a, we try the followig: >> >> %% ------------------------------------ %% >> >> gpibBd = 0; addr = 3; sub_addr = 0; % LeCroy 8901a >> pcTalk = char([64, 32 + addr]); >> pcListen = char([32, 64 + addr]); >> pcStandby = char([63, 95]); >> >> g = visa('ni', 'GPIB0::3::0::INSTR'); >> fopen(g); >> >> fprintf(g,pcTalk) >> fprintf(g,char(100)) >> fprintf(g,pcListen) >> >> fprintf(g,pcTalk) >> fprintf(g,char(33)) >> fprintf(g,pcListen) >> >> fclose(g); >> delete(g); >> >> %% ------------------------------------ %% >> >> However, nothing happen .... >> >> So, we post the issue here, and wish some help ... >> >>
|
Pages: 1 Prev: GSM RPE-LTP speech coding Next: Bootstrap Confidence Intervals |