Download X-Series Signal Generators Programming Guide

Transcript
Programming Examples
GPIB Programming Interface Examples
//
// The signal generator can be queried for conditions and instrument
states.
// These commands are of the type "*IDN?" where the question mark
indicates
// a query.
//
//*****************************************************************
#include "stdafx.h"
#include <iostream>
#include "windows.h"
#include "Decl-32.h"
using namespace std;
int GPIB0=
0;
Addr4882_t Address[31];
Addr4882_t
// Board handle
// Declare a variable of type
int main()
{
int sig;
interface descriptor
// Declares variable to hold
int num;
char rdVal[100];
instrument responses
// Declares variable to read
sig = ibdev(0, 19, 0, 13, 1, 0); // Open and initialize a device
descriptor
ibloc(sig);
local mode
// Places the signal generator in
ibclr(sig);
message
// Sends Selected Device Clear(SDC)
ibwrt(sig, "*RST", 4);
defined state
// Places signal generator in a
ibwrt(sig, ":FREQuency:CW?",14); // Querys the CW frequency
ibrd(sig, rdVal,100);
rdVal
// Reads in the response into
Keysight EXG and MXG X-Series Signal Generators Programming Guide
85