Agilent Technologies InfiniiVision 3000 Programmer's Manual page 1132

X-series
Hide thumbs Also See for InfiniiVision 3000:
Table of Contents

Advertisement

39
Programming Examples
* ------------------------------------------------------------------
* This program illustrates a few commonly-used programming
* features of your Agilent oscilloscope.
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <visa.h>
#define VISA_ADDRESS "USB0::0x0957::0x17A6::US50210029::0::INSTR"
#define IEEEBLOCK_SPACE 5000000
/* Function prototypes */
void initialize(void);
void capture(void);
void analyze(void);
void do_command(char *command);
int do_command_ieeeblock(char *command); /* Command w/IEEE block. */
void do_query_string(char *query);
void do_query_number(char *query);
void do_query_numbers(char *query);
int do_query_ieeeblock(char *query);
void check_instrument_errors();
void error_handler();
/* Global variables */
ViSession defaultRM, vi;
ViStatus err;
char str_result[256] = {0};
double num_result;
unsigned char ieeeblock_data[IEEEBLOCK_SPACE];
double dbl_results[10];
/* Main Program
* --------------------------------------------------------------- */
void main(void)
{
/* Set the I/O timeout to fifteen seconds. */
err = viSetAttribute(vi, VI_ATTR_TMO_VALUE, 15000);
1132
/* Open the default resource manager session. */
err = viOpenDefaultRM(&defaultRM);
if (err != VI_SUCCESS) error_handler();
/* Open the session using the oscilloscope's VISA address. */
err = viOpen(defaultRM, VISA_ADDRESS, VI_NULL, VI_NULL, &vi);
if (err != VI_SUCCESS) error_handler();
if (err != VI_SUCCESS) error_handler();
/* Initialize - start from a known state. */
initialize();
/* Capture data. */
capture();
Agilent InfiniiVision 3000 X-Series Oscilloscopes Programmer's Guide
/* For printf(). */
/* For strcpy(), strcat(). */
/* For clock(). */
/* Agilent VISA routines. */
/* Initialize to known state. */
/* Capture the waveform. */
/* Analyze the captured waveform. */
/* Send command. */
/* Query for string. */
/* Query for number. */
/* Query for numbers. */
/* Query for IEEE block. */
/* Check for inst errors. */
/* VISA error handler. */
/* Device session ID. */
/* VISA function return value. */
/* Result from do_query_string(). */
/* Result from do_query_number(). */
/* Result from
do_query_ieeeblock(). */
/* Result from do_query_numbers(). */

Advertisement

Table of Contents
loading

Table of Contents