Hi all,
I have a very stupid problem which drives me crazy.
We use NI GPIB USB and PCI hardware to access our measurement instruments. The software access is done using the NI 488.2 API with C++ programs.
Now I have the problem, that *one* instrument (a Keithley 6514) often failes to answer *IDN? after a Find Listeners call. We have plenty of other instruments (also other Keithley instruments) that work fine with the attached code, but this specific one not.
The manufacturer claims that everything works well with his own GPIB adaptor and his LabView program:
http://forum.keithley.com/phpBB3/viewtopic.php?f=39&t=101301&sid=a6eb2eb9c952460521b74e1d69258473
I've attached a NI Spy screenshot that shows the problem.
* First I can communicate with the instrument
* After FindLstn, there are heavy communication problems (EABO)
* After some more ibdev and a lot of failed accesses, it works again
I'm not sure if there is something wrong with my code.
Please help!
Best regards,
Andre
QString queryDevice(int board, int address)
{
int dev = ibdev(board, address, 0, T300ms, 1, 0);
ibconfig(board, IbcEOT, 1); // set EOI at command end
char buf[1024] = "*IDN?\n";
ibwrt(dev, buf, strlen(buf));
Sleep(50);
ibrd(dev, buf, sizeof(buf));
buf[ibcntl] = 0;
ibonl(dev, 0);
return QString::fromLatin1(buf).trimmed();
}
class Listener {
public:
Listener(const QString &name_, int address_) :
name(name_),
address(address_)
{
}
QString name;
int address;
};
QList<Listener> findListener(int board)
{
Addr4882_t s_list[32] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, NOADDR };
Addr4882_t r_list[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
SendIFC(board);
FindLstn(board, &s_list[0], &r_list[0], 30);
ibonl(board, 0);
Sleep(50);
QList<Listener> result;
for (int i = 0; r_list[i] > 0; ++i) {
int address = r_list[i];
const QString answer = queryDevice(board, address);
result.append(Listener(answer, address));
}
return result;
}