I have been trying to use the IviPwrMeter Error-Query.vi to read possible errors coming from the Power Meter. However, I have found that no errors can be detected using this vi. This is because the returned value 'status' is wired over to the 'error code' input of 'IviPwrMeter Error Converter.vi' and the status value will always be equal to VI_SUCCESS as the attached code signifies.
All of this code was generated by either LabWindows/CVI and/or LabView.
If I wire the error code output of 'IviPwrMeter_error_query' function to the error code input of 'IviPwrMeter IVI error converter.vi', the errors on the Power Meter is at least detected.
Am I doing something wrong here or are there other work arounds?
Source listing of driver call:
ViStatus _VI_FUNC age4418b_error_query (ViSession vi, ViInt32 *errCode,
ViChar errMessage[])
{
ViStatus error = VI_SUCCESS;
checkErr( Ivi_LockSession (vi, VI_NULL));
if (errCode == VI_NULL)
viCheckParm( IVI_ERROR_INVALID_PARAMETER, 2, "Null address for Error Code");
if (errMessage == VI_NULL)
viCheckParm( IVI_ERROR_INVALID_PARAMETER, 3, "Null address for Error Message");
if (!Ivi_Simulating(vi)) /* call only when locked */
{
ViSession io = Ivi_IOSession(vi); /* call only when locked */
checkErr( Ivi_SetNeedToCheckStatus (vi, VI_TRUE));
viCheckErr( viPrintf(io, ":SYST:ERR?"));
viCheckErr( viScanf (io, "%ld,\"%256[^\"]", errCode, errMessage));
}
else
{
/* Simulate Error Query */
*errCode = 0;
strcpy (errMessage, "No error.");
}
Error:
Ivi_UnlockSession(vi, VI_NULL);
return error;
}