Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Phantom device with address 21 on GPIB

I try to find all conncected GPIB devices with the GPIB function
"FindLstn". However, additionally to the really connceted devices
this function find something with address #21. If I disconnect all
devices, it really finds nothing (as expected). But no matter
which devices are activated (Keithley, an ols Epson printer and a
homebrew thing), this #21 appears on the list.

I use a GPIB-USB-B.

I call the routine in a C++ program as follows:

FindLstn(GPIB0, Instruments, Result, 31);
if (ibsta & ERR)
{
GPIBCleanup(GPIB0, "Unable to issue FindLstn call");
return 1;
}

int Num_Listeners = ibcntl;

for (int i=0; i < Num_Listeners; i++)
cout << Result[i] << '\n';


This odd phantom device seems to become a problem when "SendList"
ist called:

SendList(GPIB0, Result, "*IDN?", 5L, NLend);

This call always fails.

Any ideas what's happening here? Thank you!

Tschoe,
Torsten Bronger.
0 Kudos
Message 1 of 6
(4,045 Views)
I have a guess. The input into SendList requires an address list terminated by NOADDR. The output from FindLstn is an unterminated list (size determined by ibcnlt). If you pass the output from FindLstn to SendList, you are passing an unterminated list. This could cause phantom devices to be in the list. The solution is to add the line:

Result[Num_Listeners] = NOADDR;

This will terminate your list. Then, if you pass the list to SendList, it should work correctly.

Hope this works.
0 Kudos
Message 2 of 6
(4,045 Views)
The problem is device #21. Of course I can delete it from the list, but then I still don't know where it comes from. In the usenet newsgroup somebody suspected that it's the GPIB board itself. Can this be the case?
0 Kudos
Message 3 of 6
(4,045 Views)
Are you sure #21 is in the list? Or could it be that the array is not properly terminated, so the driver detects a #21 in the list that is just a part of garbage memory?
0 Kudos
Message 4 of 6
(4,045 Views)
Well, I copied original NI code for detecting the listening devices. When all devices are switched off, I really get an ibcntl of zero. If I switch one arbitrary device on, I see two: the original and 21. BTW, #21 is not always the last one in the result array.
0 Kudos
Message 5 of 6
(4,045 Views)
What is the address of your controller? I believe that FindLstn detects the address of the controller too. If your controller address is at 21, that would be a problem. When you setup the list of devices to do in FindLstn, you should not include the address of the controller.

An algorithm similar to the one below should be used.

for (Loop = 0, Address = 0; Loop < 30; Address++)
{
if (Address != ControllerPrimaryAddress)
{
Instruments[Loop] = (Addr4882_t)(Address);
Loop++;
}
}
Instruments[30] = NOADDR;

This will guarantee that your device is not included in the list. To determine the ControllerPrimaryAddress, you can run ibask with the value IbaPAD.
0 Kudos
Message 6 of 6
(4,045 Views)