
∙ |
|
|
|
∙ |
|
|
|
∙ |
|
|
|
/*** 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 |