Chapter 2 69
Programming Examples
LAN Programming Examples
//
// NOTE: You must have the Agilent IO Libraries installed to run this program.
//
// This example uses the VXI-11 protocol to set the signal generator for a 1 gHz CW
// frequency. The signal generator is queried for operation complete and then queried
// for its ID string. The frequency and ID string are then printed to the display.
//
// IMPORTANT: Enter in your signal generators hostname in the instrumentName declaration
// where the "xxxxx" appears.
//
//****************************************************************************************
#include "stdafx.h"
#include <sicl.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
INST id; // Device session id
int opcResponse; // Variable for response flag
char instrumentName[] = "xxxxx"; // Put your instrument's hostname here
char instNameBuf[256];// Variable to hold instrument name
char buf[256];// Variable for id string
ionerror(I_ERROR_EXIT);// Register SICL error handler
// Open SICL instrument handle using VXI-11 protocol
sprintf(instNameBuf, "lan[%s]:inst0", instrumentName);
id = iopen(instNameBuf);// Open instrument session