How to Log Results VISA Programming Examples
Agilent 8163A/B, 8164A/B & 8166A/B Mainframes, Fifth Edition 207
How to Log Results
This example demonstrates how to use logging functions. 
Install a Power Sensor in Slot 1, before executing this example.
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <visa.h>
 
#define MAX_LOG_VALUES 4000 /* max number of values the 
instrument is able to log */ 
#define HEADER_SIZE    7    /* includes 6 bytes header and 1 CR */
 
/* function prototypes for this examples/*
 
/* function for a simple error handling explained in example 1 */ 
void      checkError(ViStatus session, ViStatus err_status );
 
/* initialize the visa interface */
ViStatus  InitVisa ( ViSession *iHandle);
 
/*globals*/
static unsigned char logBuffer[MAX_LOG_VALUES * sizeof(ViReal64) + 
HEADER_SIZE];
/*array for the float results */
static ViReal32 logResults[MAX_LOG_VALUES];     
 
void main (void)
  {
 
   ViStatus     errStatus;      /* returned error code from visa call */ 
   ViSession    vi;             /* current session handle */ 
   ViChar       replyBuf[256];  /* buffer holding answers from the 
instrument */
   ViChar       c;              /* used in the keyboard wait loop */ 
   ViInt32      slot;           /* slot number where the power meter is 
plugged */ 
   ViInt32      chan;           /* channel to be logged */ 
   ViInt32      i;              /* loop counter */
   ViInt32      noOfValues;     /* number of values to be logged*/ 
   ViReal64     averagingTime;  /* aveaging time used in a logging cycle 
*/
   ViPChar      replySubStr;    /* pointer to a substring of the 
instruments reply */