Agilent Technologies FS2010 Guide de l'utilisateur Page 80

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 160
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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);
.
.
Vue de la page 79
1 2 ... 75 76 77 78 79 80 81 82 83 84 85 ... 159 160

Commentaires sur ces manuels

Pas de commentaire