03-05-2013 02:12 AM
For a special measurement I have so set gatetime to 120 s. Then you have to expect that the measurement needs at least 120 seconds. So I'am calling ag532xx_Read() with 125s timeout (ag532xx_Read (_tmp1, 125000, &_tmp12);) . That doesn't seem to work.
Debugging into driver shows that it sets AG532XX_ATTR_OPC_TIMEOUT to 125000, but in ag532xx_WaitForOPCCallback() the viQueryf(io, "*OPC?", "%hd", &opcDone) times out after 5 seconds and returns with a BFFF0015 error, which is then remapped to AG532XX_ERROR_MAX_TIME_EXCEEDED in ag532xx_Read().
Might it be that there is some Code, that should set the timeout for the viQuery(), is missing in WaitForOPCCallback() ?
PS: The driver source identifies itself as:
/*****************************************************************************
* Agilent 532xx Frequency Universal Counter Instrument Driver
* LabWindows/CVI Instrument Driver
* Original Release: July 25, 2011
* By: hfeng,
* PH. 021-50509810
*
* Modification History:
*
* July 25, 2011 - Instrument Driver Created.
*
***********************************************************************
Solved! Go to Solution.
03-05-2013 04:35 AM - edited 03-05-2013 04:39 AM
Answering myself.: Changing ag532xx_WaitForOPCCallback() from
static ViStatus _VI_FUNC ag532xx_WaitForOPCCallback (ViSession vi, ViSession io)
{
ViStatus error = VI_SUCCESS;
ViInt32 opcTimeout;
ViBoolean opcDone = VI_FALSE;
checkErr( Ivi_GetAttributeViInt32 (vi, VI_NULL, AG532XX_ATTR_OPC_TIMEOUT,
0, &opcTimeout));
viCheckErr(viQueryf(io, "*OPC?", "%hd", &opcDone));
Error:
viDiscardEvents (io, VI_EVENT_SERVICE_REQ, VI_QUEUE);
return error;
}
to
static ViStatus _VI_FUNC ag532xx_WaitForOPCCallback (ViSession vi, ViSession io)
{
ViStatus error = VI_SUCCESS;
ViInt32 opcTimeout,oldVISATimeout;
ViBoolean opcDone = VI_FALSE;
checkErr( Ivi_GetAttributeViInt32 (vi, VI_NULL, AG532XX_ATTR_OPC_TIMEOUT,
0, &opcTimeout));
viCheckErr(viGetAttribute (io, VI_ATTR_TMO_VALUE, &oldVISATimeout));
viCheckErr(viSetAttribute (io, VI_ATTR_TMO_VALUE, opcTimeout));
viCheckErr(viQueryf(io, "*OPC?", "%hd", &opcDone));
viCheckErr(viSetAttribute (io, VI_ATTR_TMO_VALUE, oldVISATimeout));
Error:
viDiscardEvents (io, VI_EVENT_SERVICE_REQ, VI_QUEUE);
return error;
}
seems to fix the problem for me. Is this the right fix for the problem or does it just hide the real bug ?
03-06-2013 06:13 AM
hey mkossmann,
if you are pogrammin a serial device through the VISA layer ( using GPIB) , the use of SCPI commands are required.
But when your selfmade fix does work it is fine as well.
Regards
Roman Imhoff
03-06-2013 08:41 AM
*OPC? is definitely a standard SCPI command, which has to be implemented in all SCPI compliant devices ( see chapter 4.1.1 of http://www.ivifoundation.org/docs/SCPI-99.PDF).
03-06-2013 09:34 AM
The WaitForOPCCallback function timeout value remained unchanged after setting AG532XX_ATTR_OPC_TIMEOUT attribute. Thank you mkossmann for pointing this out.
We have made this change to the source and will try to rebuild and release the installer before the end of the week.