Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

"*IDN?" Query Problem

Hello,

I have some problems with programming NoiseKen instrument over NI GPIB-USB-HS.
When I try to create a function that will query for some data from the instument I always get a timeout error.
In fact I implemented a function that is combination of ibwrt, ibwait and ibrd function calls. ibwait function is used to wait for the RQS event.

The first point is that I don't understand why I can get timeout on ibwait function call after I sent command "*IDN?" or any query command supported by instrument.
Instrument documentation specify that it conforms to the IEEE 488.2-1987.

When I remove ibwait function call, the problem moves to the ibrd function.
But cause of this problem is like instrument may not answer for the query for the moment I begin reading process.
In some cases the result string contains only "N" instead of "Noiseken..."
If I put sleep for 50-100 ms instead of ibwait call everything works fine, but such sollution is not the best for me.

I also tried MAX's "NI-488.2 Communicator" tool.
In this case I also had a problem with Query (Timeout), but everything worked fine when I manually clicked Send and then Receive button.
But MAX's "Scan for Instruments" mostly shows correct identification string for the instrument.
Though in some cases here also appears the same problem that I experienced during programming. (Only "N" was received instead of full identification string).

What can be the reason of described problems? Some posts on this forum made me on mind that it's because of GPIB-USB-HS cable.
But maybe the problem is in the instrument slow productivity.

Thanks in advance.
0 Kudos
Message 1 of 5
(7,818 Views)
Hi,
 
What version of LabVIEW, 488.2 driver, and Measurement and Automation are you currently using? 
Is LabVIEW returning an error code, if so what is the error?
Are you using the LabVIEW GPIB example, if not I would recommend using it to see if the example gives the same result. 
If you programmed the code, are you using the error terminals to control the order of execution in your code? 
Do you have another instrument that you could communicate with using the USB-GPIB-HS, to verify it is not the instrument? 
Does the instrument have the latest firmware installed?

Regards,
Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(7,774 Views)
Hi,

I'm using Measurement&Automation version 4.2.1.3001 and 488.2 driver version 2.5.
I'm writing program in C++, so I'm not able to tell you if errors appear in LabView examples.
But the mostly strange is that MAX Query also gets the timeout error.

I was testing USB-GPIB-HS with HP 8752 Network Analyzer. And the result was that MAX worked with it correctly.
But in my source I again had a problem with ibwait function. Without call of this function everything works fine, but I don't understand why.
I have only ibwrt and ibrd function calls there, and I'm not sure that I will always get correct result of query.
It only depends on instrument operation speed, and in case of time consuming query operation I will again receive an error, but on the ibrd function call.
Am I right?

Though I'm still not sure that I made correct imlementation. It seems that RQS is not set, and that's why I get timeout on the
ibwait(DeviceDescriptor,(TIMO | RQS));
What steps should be processed to be sure, that RQS will be set when instrument answered on the query I'm sending with ibrwt function call?
Does it depend on the instrument?

So, now I don't know if the problem is not in the cable, because I cannot catch RQS event with both devices I have (NoiseKen and HP 8752).
And I still don't understand why MAX Query for the simple "*IDN?" command rises up timeout error.

Can you please also tell me where can I find latest version of the "Decl-32.h" and "gpib-32.obj" files.
I'm not able to find them in the folder where I installed the driver.

Thanks in advance.
0 Kudos
Message 3 of 5
(7,754 Views)
Hi,
 
I would suggest taking a NI-Spy Capture of the 488.2 driver calls being made.  The Knowledgebase article Performing a Good NI-Spy Capture for Debugging/Troubleshooting will help you with this process.  This will give us a better idea of why ibwait is returning a timeout error.
 
I couldn't find an owner’s manual for your instrument so I don't you know if the NoiseKen instrument responds to serial polls?  You should be able to find this information in the manual. 
 
From the 488.2 Help you should not issue an ibwait on RQS for a device that does not respond to serial polls. Use ibrsp to acquire the serial poll response byte that was received. RQS is cleared when all of the stored serial poll response bytes have been reported to you through the ibrsp function.
 
Regards,


Message Edited by Andy L on 12-28-2007 09:47 AM
Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(7,740 Views)
Hello,

I made investigations you advised me with NI-Spy, But in fact it did not tell me anything new. Attached you can find log file generated by NI-Spy. With this file you can see points where error occurred (4,6, and 14-th lines). These happened when I used Query button to send/receive result of the "*IDN?" command with MAX. Also there are points where no errors occurred. These are situations when I manually clicked Send and Receive buttons.

I also tried to find in the documentation any information about Serial Polling support, and the result was poor enough. I will quote a paragraph that seems to be interesting but not clear to me:


When the wrong command or data is sent from the controller or controller service is required for processing, the machine can send Service Request (SRQ) to the controller. When Serial Poll is performed after the controller receives SRQ, the machine sends out Status byte. When the machine sends Service Request (SRQ), NEW REASON FOR SERVICE is required. New Reason for Service is generated by one of the followings:
1. One bit of Status Byte was already set and the bit of corresponding Service Request Enable register at the time was already set.
2. One bit of Service Request Enable register was already set and the bit of corresponding Status Byte at the time was already set.
3. One bit of Status byte and the bit of corresponding Service request Enable Register were set at the same time.


It seems to me that I have to use combination of IBRSP and IBRSV functions and correct mask defined with SRE register to wait for the correct moment when I should read queried data from the instrument, but finally I don’t understand what I have to do.

May be anyone had the similar problems, or how should I query data from the instrument in case if it doesn’t support automatic serial polling?

Thanks in advance,

Andrey
0 Kudos
Message 5 of 5
(7,622 Views)