Agilent Technologies 8166A Manual Do Utilizador

Página de 274
VISA Programming Examples
How to Set up a Fixed Laser Source
192
Agilent 8163A/B, 8164A/B & 8166A/B Mainframes, Fifth Edition
How to Set up a Fixed Laser 
Source
This example sets up a fixed laser source.
Install a Laser Source in Slot 2, before executing this example. 
#include <stdio.h>
#include <stdlib.h>
#include <visa.h>
/* function prototypes for this examples */
/* function for simple error handling explained in example 1 */
void checkError(ViSession session, ViStatus err_status );
void main (void)
    {
    ViStatus            errStatus;          /*  returned  error  code  from  visa  call  */
    ViSession          defaultRM;          /*  default  visa  resource  manager 
variable*/
    ViSession          vi;                        /*  current  session  handle  */     
    ViChar                c;                          /*  used  in  the  keyboard  wait  loop  */ 
    ViReal32    wavelength;                /*  wavelength  of  the  laser  source  */ 
        /*  initialize  the  visa  library  (see  example  1)  */
        errStatus  =  viOpenDefaultRM  (&defaultRM);
        if(errStatus  <  VI_SUCCESS)
            {
                printf("Failed  to  open  VISA  Resource  manager\n");     
                exit(errStatus); 
            }
        /*  Open  session  to  GPIB  device  at  address  20;*/ 
        errStatus  =  viOpen  (defaultRM,  "GPIB::20::INSTR", 
VI_NULL,VI_NULL,&vi);
        if(errStatus  <  VI_SUCCESS)
            {
                printf("Failed  to  open  instrument\n");     
                exit(errStatus); 
            }
        /*set  timeout  to  20  sec;  this  should  work  for  all  commands  except 
zeroing */