How to Log Results
Agilent 8163A/B, 8164A/B & 8166A/B Mainframes, Fifth Edition
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
/* 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;
ViSession
vi;
ViChar
replyBuf[256]; /* buffer holding answers from the
instrument */
ViChar
c;
ViInt32
slot;
plugged */
ViInt32
chan;
ViInt32
i;
ViInt32
noOfValues;
ViReal64
averagingTime; /* aveaging time used in a logging cycle
*/
ViPChar
replySubStr;
instruments reply */
VISA Programming Examples
7
/* includes 6 bytes header and 1 CR */
/* returned error code from visa call */
/* current session handle */
/* used in the keyboard wait loop */
/* slot number where the power meter is
/* channel to be logged */
/* loop counter */
/* number of values to be logged*/
/* pointer to a substring of the
207