Agilent Technologies Model A.08.xx Water Dispenser User Manual


 
154 Chapter 3
Programming Examples
Status RegisterDetermine When a Measurement is Done
/*install the handler and enable it */
viInstallHandler(viESA, VI_EVENT_SERVICE_REQ, mySrqHdlr,iAddress);
viEnableEvent(viESA, VI_EVENT_SERVICE_REQ,VI_HNDLR,VI_NULL);
/*Send an undefined command to the device*/
viPrintf(viESA,"IDN\n");
/*Wait for SRQ */
WaitForSRQ();
/* Pause 5 seconds to observe error message displayed on ESA*/
Sleep(5000);
/*Averaging the successive measurements, Set video averaging to 80 sweeps,
/*Turn the avarage On*/
viPrintf(viESA,":SENS:AVER:TYPE LPOW;:SENS:AVER:COUN 80;:SENS:AVER:STAT ON\n");
/* Set the service request mask to assert SRQ when either a measurement
is completed or an error message has occurred.*/
viPrintf(viESA,"*SRE 96\n");
viPrintf(viESA,"*ESE 35\n");
/*Trigger the sweeps and set the *OPC bit after the sweeps are completed*/
viPrintf(viESA,":INIT:IMM;*OPC\n");
/*Wait for SRQ */
WaitForSRQ();
/*Disable and uninstall the interrupt handler*/
viDisableEvent (viESA, VI_EVENT_SERVICE_REQ,VI_HNDLR);
viUninstallHandler(viESA, VI_EVENT_SERVICE_REQ, mySrqHdlr,iAddress);
/*Clear the instrument status register*/
viPrintf(viESA,"*SRE 0 \n");
/*Clear the status byte of the instrument*/
viPrintf(viESA,"*CLS\n");
/*Close the session*/
viClose(viESA);
viClose(defaultRM);
}