Digital Multimeters (DMMs) and Precision DC Sources

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DMM 2.9 driver error handling

Hi,

 

I am using the NI-DMM 2.9 instrument driver to control a PXI-4065 DMM.  My code is written in C++

 

The following doesn't work correctly:

 

errNum = niDMM_GetError(hHandle, errcode, bufSize, errDescrip);       // This function returns status = 85

 

I attempt to retrieve the error message that corresponds to errcode 85 with the following call:

 

status = niDMM_error_message(hHandle, errNum, sErrMsg);             // This function returns status = 0 but the driver doesn't store any data in sErrMsg and it is left pointing to null.

 

I believe that error codes > 0 are warnings and error codes < 0 are errors.  A few warnings are defined in nidmm.h, but not one for 85.  What is this warning and why doesn't the driver return a description for it?  I don't have the hardware yet and am debugging my code with the DMM set up in simulation through MAX.  I wonder if the warning is related to this?

 

Thanks a lot,

 

Dan

0 Kudos
Message 1 of 5
(7,396 Views)

Sorry, there's a typo in my last post.

 

errNum = niDMM_GetError(hHandle, errcode, bufSize, errDescrip);       // This function returns errNum = 85

 

Sorry for any confusion.

 

0 Kudos
Message 2 of 5
(7,394 Views)

Hello,

 

What are the values you are passing for variables bufSize and errDescrip?

 

In order for you to know how much memory to allocate for the ViChar* errDescrip that will get returned by the driver, you should call this function with bufSize = 0 and VI_NULL for errDescrip. The function then returns the number of bytes needed in order to fit in the full error description.

 

Allocate the memory for errDescrip.

 

Then you call niDMM_GetError again, this time passing the value returned on the first call for bufSize, and the allocated string for errDescrip.

 

Hope this helps.

Marcos 

Marcos Kirsch
Chief Software Engineer
NI Driver Software
0 Kudos
Message 3 of 5
(7,370 Views)

Hi Marcos,

 

Thanks for your reply.  I should have posted the values that I was passing because that isn't the problem.  It is a very good idea to implement one's code as you noted to make sure that you don't get run time memory overruns.

 

The problem isn't with the call to niDMM_GetError.  That function returns with errcode = 0 and no string in errDescrip.  That part is fine.  The problem is that errNum = 85, which I presume means that a warning occurred when the driver called niDMM_GetError().  I passed the return code from niDMM_GetError (85) to niDMM_error_message to get the description for code 85, and that's when the problem occurs.  niDMM_error_message() returns status = 0, which indicates that it was successful, but sErrMsg doesn't contain a string to identify what code 85 means.  In other words, the driver returned error code 85, but it doesn't return a string that describes what that means.  I hope that I explained the issue better this time.

 

Thank you,

 

Dan

0 Kudos
Message 4 of 5
(7,362 Views)

That's interesting. Would it be possible for you to attach a little C example that reproduces the problem so I can try it and debug it? 85 does not sound like a warning that NI-DMM would return, as it does not fall within the range specified by IVI.

 

Marcos 

Marcos Kirsch
Chief Software Engineer
NI Driver Software
0 Kudos
Message 5 of 5
(7,360 Views)