01-15-2009 01:57 PM
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
01-15-2009 02:00 PM
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.
01-16-2009 02:19 PM
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
01-16-2009 05:07 PM
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
01-16-2009 05:52 PM
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