Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Instrumentation Driver Developer Guide Documentation Error p9-44 Ivi_UnlockSession

The source code as listed causes subsequent calls to attribute methods to lock up the development session. Which solution is preferable? Remove the Ivi_UnlockSession statement or add a Ivi_LockSession statement at the top of the method?
0 Kudos
Message 1 of 2
(3,401 Views)
Hello Larry,
This looks like a mistake in the DDG Manual. The recommendation would be to add Ivi_LockSession at the top as in the following code (from the latest fl45 source):

ViStatus _VI_FUNC fl45_ConfigureHold (ViSession vi, ViBoolean holdEnable,
ViInt32 holdThreshold)
{
ViStatus error = VI_SUCCESS;

checkErr( Ivi_LockSession (vi, VI_NULL));

viCheckParm( Ivi_SetAttributeViBoolean (vi, VI_NULL, FL45_ATTR_HOLD_ENABLE,
0, holdEnable), 2, "Hold Enable");

if (holdEnable)
viCheckParm( Ivi_SetAttributeViInt32 (vi, VI_NULL, FL45_ATTR_HOLD_THRESHOLD,
0, holdThreshold), 3, "Hold Threshold");

checkErr( fl45_CheckStatus (vi));

Error:
Ivi_Un
lockSession (vi, VI_NULL);
return error;
}


If you are interested in driver development, I would recommend downloading some drivers from our website (http://www.ni.com/idnet) and walking through them -- we provide the source to many complete drivers.

Sincerely,
Jeremiah Cox
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 2
(3,401 Views)