beautypg.com

HP E1418A User Manual

Page 50

background image

/*** SCPI Error check ***/
void sys_err(ViSession resource)

{
char buf [1024] = {0};
int err_no;
err = viPrintf (resource, “SYST:ERR?\n”); /* query error queue */
if (err < VI_SUCCESS) err_handler(resource,err);
err = viScanf (resource,"%d%t",&err_no,&buf); /* get error number and string */
if (err < VI_SUCCESS) err_handler(resource,err);
while (err_no != 0)

{
printf (“\nCommand Error: %d,%s\n”,err_no,buf);
err = viPrintf (resource, “SYST:ERR?\n”); /* query error queue */
if (err < VI_SUCCESS) err_handler(resource,err);
err = viScanf (resource,"%d%t",&err_no,&buf); /* get error number and string */
if (err < VI_SUCCESS) err_handler(resource,err);
}

return;
}

/*** End of SCPI error check ***/

Chapter 2

Programming Examples 49

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com