Agilent Technologies E1441A Manuale Utente

Pagina di 206
Agilent E1441A Function/Arbitrary Waveform Generator Module Setup  
17
Chapter 1
Initial Operation
To program the Function Generator using SCPI, you must select the 
interface address and SCPI commands to be used. Guidelines to select SCPI 
commands for the Function Generator follow. See the Agilent 75000 Series 
C Installation and Getting Started Guide for interface addressing.
Note
This discussion applies only to SCPI (Standard Commands for 
Programmable Instruments) programming. The program is written using 
Agilent VISA function calls. Agilent VISA allows you to execute on 
VXIplug&play system frameworks that have the VISA I/O layer installed 
(visa.h include file).
Programming the
Function Generator
Example: Perform a Function Generator Self-Test and Read the Result.
Programming the Function Generator using Standard Commands for 
Programmable Instruments (SCPI) requires that you select the controller 
language (e.g., C, C++, Basic, etc.), interface address and SCPI commands 
to be used. See the "C-Size Installation and Getting Started Guide" (or 
equivalent) for interfacing, addressing and controller information.
The following C program verifies communication between the controller, 
mainframe and Function Generator. It resets the module (*RST), queries the 
identity of the module (*IDN?) and initiates a self-test of the Function 
Generator. See the program 1441init.c on the Instrument Drivers CD.
#include <stdio.h>
#include <visa.h>
/*** FUNCTION PROTOTYPE ***/
void err_handler (ViSession vi, ViStatus x);
#define DEVICE_ADDRESS "GPIB0::9::10::INSTR"
void main(void)
{
char buf[512] = {0};
#if defined(_BORLANDC_) && !defined(_WIN32_)
_InitEasyWin();
#endif
ViStatus err;
ViSession defaultRM, funcgen;
/* Open resource manager and Function Generator sessions*/
viOpenDefaultRM (&defaultRM);
viOpen(defaultRM, DEVICE_ADDRESS,VI_NULL, VI_NULL, &funcgen);
/* Set the timeout value to 10 seconds. */
viSetAttribute(funcgen, VI_ATTR_TMO_VALUE, 10000);