Digital Multimeters (DMMs) and Precision DC Sources

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI 4071 Error_Query

Hi,
 
How to use the Error_Query() in PXI 4071 to get the latest error?

int

error_query(System.IntPtr Instrument_Handle, out int Error_Code, System.Text.StringBuilder Error_Message);

 

Code snippet:

int

 r = IVIDMM_Fetch(10000, out rValue); //This stmt throws an error because initiate() is not called before Fetch()

int

errCode = 0;

string errMsg = "";

StringBuilder sb = new StringBuilder(errMsg);

IVIDMM_error_query(

ref errCode, ref errMsg); //This stmt does not get the error message/code of the previous error

 

What should be passed to the error_query() stmt to get the latest error message?

Thanks,

Priya.

 

 

 

0 Kudos
Message 1 of 3
(6,706 Views)
Hello Pirya,

Thanks for your post! I see that you are trying to get the error handling to work with your IVI DMM functions. I notice that you are missing the ViSession or Instrument Handle from your IVIDMM_error_query function. The instrument handle is information that you obtain from the IVIDMM_init or IVIDMM_initwithoptions functions. So at the moment there is nothing to identify a patricular session.

So even though there is no "init" called in your program the instrument handle r should be placed in the "error_querry" function.
IVIDMM_error_query(r, ref errCode, ref errMsg);
Adding the instrument handle should allow the function to associate its self with the session you have open.

Please post back if you have any further questions!

Cheers

Corby_B
http://www.ni.com/support

0 Kudos
Message 2 of 3
(6,675 Views)

Hi,

Thanks for the reply! Actually i do have the handle and have called the init before this method call. Basically i am calling the .Net wrappers created by Measurement studio. This is the method i am calling:

public

int error_query(out int Error_Code, System.Text.StringBuilder Error_Message)

{

int pInvokeResult = PInvoke.error_query(this._handle, out Error_Code, Error_Message);

PInvoke.TestForError(this._handle, pInvokeResult);

return pInvokeResult;

}

The this._handle is already set. So i do have the handle but not able to get the error code and error message of the recent error 😞

StringBuilder

sb = new StringBuilder(errorMessage);

int status = DmmClassDriver.error_query(

out errorCode, sb); //calls the method given above...

 

Thanks,

Priya.

0 Kudos
Message 3 of 3
(6,661 Views)