Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ibwrt fails with EDVR after initialization

I have written a small program to write to and read from an HP8563 spectrum analyzer. The operational portion of the code will eventually go into a much larger instrument control application. I am using a GPIB/ENET100 controller. The code is written in Borland C++ Builder 5.0.
 
The connection to the specan is good, since I can interact with it using ibic. MAX shows the controller with the proper settings.
 
My problem is that, after initialization, if I send a write command to the specan, it returns with an EDVR error. Below is a listing from NiSpy during the initialization and first ibwrt.  The ellipses show breaks where the data is irrelevant or repetitive.  Note the indent on line 47 is intentional. That is how NiSpy displayed it. I did not do this ibfind.
...
3 ibfind(GPIB2)                                                    0x0130   0             0x0000
4 ibfind(GPIB2)                                                    0x0130   0             0x0000
5 ibonl(2, 1)                                                          0x0100   0             0x0000
6 ibrsc(2, 1)                                                          0x0100   1             0x0000
7 ibsic(2)                                                              0x0130   0             0x0000
8 ibsre(2, 1)                                                          0x0130   0             0x0000
...
14 ibln(2, 0, NO_SAD(0), FALSE(0))                   0x0130   0             0x0000
...
31 ibln(2, 18, NO_SAD(0), TRUE(0))                    0x0130   0             0x0000
32 ibdev(2, 18, 0(0x0), T10s(13), 1, 0x0000)        0x0100   0             0x0000
33  ibln(2, 19, NO_SAD(0), FALSE(0))                  0x0130   0             0x0000
...
44 ibln(2, 30, NO_SAD(0), FALSE(0))                   0x0130   0             0x0000  
45 ibdev(2, 18, 0(0x0), T10s(13), 1, 0x0000)         0x0100   0             0x0000
46 ibwrt(18), "cf?", 3(0x3))                                      0x8000   EDVR(0)  0xE0140025
47      ibfind(GPIB18)                                               0x8000   EDVR(0)  0xE0140025
 
My code is attached. The functions/events in question are Initialize1Click and btnSendClick in Unit1.cpp and FindGpibAll and GPIBCmd in gpib.cpp. I have been trying to track this down for more than a week, now. Any help will be greatly appreciated. Thanks.
 
Download All
0 Kudos
Message 1 of 2
(3,165 Views)
Hi cdavel,
 
The problem I see is that you appear to be passing the actual primary address of the instrument to ibwrt, rather than the unit descriptor you obtain from your ibdev call.  Your GetDev returns the unit descriptor from ibdev() , but the code in Unit1.cpp just throws this away.  This unit descriptor is crucial, as it will be passed on to your device level calls, such as ibdev.
 
This also explains the ibfind(18) which you never called.  When the ibwrt() is issued with 18 as a parameter, it is assuming that you are trying to do a board level write on GPIB18.  Once you properly pass in the unit descriptor to the ibwrt call (and any other device level calls), things should work fine.
 
Jason S.
GPIB & Serial
National Instruments
Message 2 of 2
(3,143 Views)