Agilent Technologies E2094S Guia do Utilizador Página 69

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 146
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 68
Programming with VISA 3
Agilent VISA User’s Guide 69
char err_msg[1024]={0};
viStatusDesc (vi, err, err_msg);
printf ("ERROR = %s\n", err_msg);
return;
}
Example: Checking Instrument Errors When programming
instruments, it is good practice to check the instrument to ensure there
are no instrument errors after each instrument function. This example
uses a SCPI command to check a specific instrument for errors.
void system_err(){
ViStatus err;
char buf[1024]={0};
int err_no;
err=viPrintf(vi, "SYSTEM:ERR?\n");
if (err < VI_SUCCESS) err_handler (vi, err);
err=viScanf (vi, "%d%t", &err_no, &buf);
if (err < VI_SUCCESS) err_handler (vi, err);
while (err_no >0){
printf ("Error Found: %d,%s\n", err_no,
buf);
err=viScanf (vi, "%d%t", &err_no, &buf);
}
err=viFlush(vi, VI_READ_BUF);
if (err < VI_SUCCESS) err_handler (vi, err);
err=viFlush(vi, VI_WRITE_BUF);
if (err < VI_SUCCESS) err_handler (vi, err);
}
Exception Events
An alternative to trapping VISA errors by checking the return status
after each VISA call is to use the VISA exception event. On sessions
where an exception event handler is installed and
VI_EVENT_EXCEPTION is enabled, the exception event handler is
called whenever an error occurs while executing an operation.
Vista de página 68
1 2 ... 64 65 66 67 68 69 70 71 72 73 74 ... 145 146

Comentários a estes Manuais

Sem comentários