Agilent Technologies FS2010 Guida Utente Pagina 80

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 160
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 79
80 Agilent VISA User’s Guide
3 Programming with VISA
Trapping Errors
This section provides guidelines for trapping errors,
including:
Trapping Errors
Exception Events
Trapping Errors
The sample programs in this guide show specific VISA
functionality and do not include error trapping. Error
trapping, however, is good programming practice and is
recommended in all your VISA application programs. To trap
VISA errors you must check for VI_SUCCESS after each
VISA function call.
If you want to ignore WARNINGS, you can test to see if err
is less than (<) VI_SUCCESS. Since WARNINGS are greater
than VI_SUCCESS and ERRORS are less than VI_SUCCESS,
err_handler would only be called when the function returns
an ERROR. For example:
if(err < VI_SUCCESS) err_handler (vi, err);
Sample: Checking for VI_SUCCESS
This sample illustrates checking for VI_SUCCESS. If
VI_SUCCESS is not returned, an error handler (written by
the programmer) is called. This must be done with each
VISA function call.
ViStatus err;
.
.
err=viPrintf(vi, "*RST\n");
if (err < VI_SUCCESS) err_handler(vi, err);
.
.
Vedere la pagina 79
1 2 ... 75 76 77 78 79 80 81 82 83 84 85 ... 159 160

Commenti su questo manuale

Nessun commento