home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / SICL / data1.cab / sicl32 / c / samples / misc / formatio.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-02  |  1.2 KB  |  50 lines

  1. /* formatio.c
  2.    This example program makes a multimeter mesurement with a comma  
  3.    separated list passed with formatted I/O and prints the results
  4. */
  5.  
  6. #include <sicl.h>
  7. #include <stdio.h>
  8.  
  9. main()
  10. {
  11.    INST dvm;
  12.  
  13.    double res;
  14.    double list[2] = {1,0.001};
  15.  
  16.    #if defined(__BORLANDC__) && !defined(__WIN32__)
  17.       _InitEasyWin();    /* required for Borland EasyWin programs */
  18.    #endif
  19.  
  20.    /* Log message and terminate on error */
  21.    ionerror (I_ERROR_EXIT);
  22.  
  23.    /* Open the multimeter session */
  24.    dvm = iopen ("hpib7,16");
  25.    itimeout (dvm, 10000);
  26.  
  27.    /*Initilize dvm*/
  28.    iprintf (dvm, "*RST\n");
  29.  
  30.    /*Set up multimeter and send comma separated list*/
  31.    iprintf (dvm, "CALC:DBM:REF 50\n");
  32.    iprintf (dvm, "MEAS:VOLT:AC? %,2lf\n", list);
  33.  
  34.    /* Read the results */
  35.    iscanf (dvm,"%lf", &res);
  36.  
  37.    /* Print the results */
  38.    printf ("Result is %f\n", res);
  39.  
  40.    /* Close the mulitmeter session */
  41.    iclose (dvm);
  42.  
  43. /* For WIN16 programs, call _siclcleanup before exiting to release
  44.    resources allocated by SICL for this application.  This call
  45.    is a no-op for WIN32 programs. */
  46.    _siclcleanup();
  47.  
  48.    return 0;
  49. }
  50.