Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

how to check if measurement is done through SRQ

Highlighted

how to check if measurement is done through SRQ

Here is the code, but it doesn't work, can anybody help?

 

main()

{

status = viOpenDefaultRM(&defaultRM);
status = viOpen(defaultRM, "GPIB0::18::INSTR", VI_NULL, VI_NULL, &viSA);
viSetAttribute(viSA, VI_ATTR_TMO_VALUE, 20000);
viClear(viSA);

viInstallHandler(viSA, VI_EVENT_SERVICE_REQ, myCallback, bufferHandle);
viInstallHandler(viSA, VI_EVENT_IO_COMPLETION, myCallback, bufferHandle);
viEnableEvent(viSA, VI_EVENT_SERVICE_REQ, VI_HNDLR, VI_NULL);
viEnableEvent(viSA, VI_EVENT_IO_COMPLETION, VI_QUEUE, VI_NULL);

//start porform channel power measurement....

viPrintf(viSA, ":INITiate:CHPower\n");
status = viWaitOnEvent(viSA, VI_EVENT_IO_COMPLETION, 30000, &etype, &eventContext);

 

if (status < VI_SUCCESS) {
/* Waveform not received...exiting */
free(bufferHandle);
viClose(defaultRM);
return;
}

//try to fetch channel power here, but it never get there.

viPrintf(viSA, ":FETCH:CHP:CHP?\n");
viRead(viSA, (ViBuf)buf, 20, &numRead);
}

 

//callback

ViStatus _VI_FUNCH myCallback(ViSession vi, ViEventType etype, ViEvent eventContext, ViAddr userHandle)
{

ViJobId jobID;
ViStatus status;
ViUInt16 stb;
status = viReadSTB(vi, &stb);
status = viReadAsync(vi, (ViBuf)userHandle, 1024, &jobID);
return VI_SUCCESS;

}

 

0 Kudos
Message 1 of 1
(277 Views)