Chapter 2 Scpi Programming; Example 1: Reset, Self Test, Module Id - Agilent Technologies E2261A User's Manual And Programming Manual

Quad rs-232 interface m-module
Table of Contents

Advertisement

General Information
Example 1: Reset,
Self Test,
Module ID
This chapter describes how to use and program the Agilent E2261A Quad
RS-232 Port M-Module with the Standard Commands for Programmable
Instruments (SCPI). This chapter includes example programs and a
complete SCPI Command Reference.
Note
Do not do register writes if you are controlling the module by the high level
driver. This is because the driver will not know the module state and an
interrupt may occur causing the driver and/or command module to fail.
The following example programs were developed with the ANSI C
language using the Agilent VISA extensions. The program was written and
tested in Microsoft
ANSI C compiler.
To run the programs you must have the Agilent SICL Library, the Agilent
VISA extensions, and an Agilent 82340 or 82341 GPIB module installed
and properly configured in your PC. An Agilent E1406 Command Module
is required.
The following example reads the module ID string, performs module
self-test, displays the results, closes channel 02 and queries the channel
closure state. The result is returned to the computer and displayed
("1" = channel closed, "0" = channel open).
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
/* Interface address is 112, Module secondary address is 9*/
#define INSTR_ADDR "GPIB0::9::9::INSTR"
int main()
{
ViStatus errStatus; /*Status from each VISA call*/
ViSession viRM;
ViSession E2261A; /* Module session */
char id_string[256]; /*ID string*/
char selftst_string[256]; /*self-test string*/
/* Open the default resource manager */
errStatus = viOpenDefaultRM ( &viRM);
if(VI_SUCCESS > errStatus){
SCPI Programming
®
Visual C++ but should compile under any standard
/*Resource mgr. session */
Chapter 2
SCPI Programming
13

Advertisement

Table of Contents
loading

Table of Contents