Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you check the error queue/status bits on a device?

JS,
You're very close with your last thought - you're polling the status byte faster than the instrument is posting new status information. When you step through the code, you're slowing down your program execution enough that the device is posting its status results before you do the serial poll. Check out page 139 of the programming manual I sent you a link to earlier. There's a section on that page about how to use *OPC (Operation complete) to ensure that commands are done being processed before you try to query the device for its status.
0 Kudos
Message 11 of 12
(1,133 Views)
The manual says to send the *OPC command after a command that is supposed to load something into the output buffer. Then to check the operation complete bit (first bit of the ESR) to see when it gets set.

I have managed to send the *OPC command after the command the user types in via appending it followed by a *IDN? command which turns it into a "command string." Simply sending it following the user's command results in error -410 Query Interrupted - "A command was received which send data to the output buffer, but the output buffer contianed data from a previous query."

However, I cannot think of a way to check the operation complete bit (or any status bit for that matter) without using a command that writes to the output buffer (ie *OPC? or ESR? to check to see if the operation complete bit is set). Using either of these will destroy any output from a valid command. Is there a way to check bits without utilizing the output buffer - thus keeping output from valid commands intact?

I think I may just use the wrapper class created from the device driver when I program my application, instead of using lower level code.
CLA, CCVID, Certified Instructor
0 Kudos
Message 12 of 12
(1,119 Views)