Local lockout using ni-488.2 and c, Local lockout using ni- 488.2 and c – Agilent Technologies N5183A MXG User Manual

Page 81

Advertising
background image

Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide

71

Programming Examples

GPIB Programming Interface Examples

Local Lockout Using NI-488.2 and C++

This example uses the NI- 488.2 library to set the signal generator local lockout mode. Launch
Microsoft Visual C++ 6.0, add the required files, and enter the following code into your .cpp source
file. niex2.cpp performs the following functions:

all front panel keys, except the contrast key

places the signal generator into remote

prompts the user to verify the signal generator is in remote

places the signal generator into local

The following program example is available on the signal generator Documentation CD- ROM as
niex2.cpp

.

// ************************************************************************************

// PROGRAM NAME: niex2.cpp

//

// PROGRAM DESCRIPTION: This program will place the signal generator into

// LOCAL LOCKOUT mode. All front panel keys, except the Contrast key, will be disabled.

// The local command, 'ibloc(sig)' executed via program code, is the only way to

// return the signal generator to front panel, Local, control.

// ************************************************************************************

#include "stdafx.h"

#include <iostream>

#include "windows.h"

#include "Decl-32.h"

using namespace std;

int GPIB0= 0; // Board handle

Addr4882_t Address[31]; // Declares a variable of type Addr4882_t

int main()

{

int sig; // Declares variable to hold interface descriptor

sig = ibdev(0, 19, 0, 13, 1, 0); // Opens and initialize a device descriptor

ibclr(sig); // Sends GPIB Selected Device Clear (SDC) message

ibwrt(sig, "*RST", 4); // Places signal generator in a defined state

cout << "The signal generator should now be in REMOTE. The remote mode R "<<endl;

cout <<"annunciator should appear on the signal generator display."<<endl;

cout <<"Press Enter to continue"<<endl;

cin.ignore(10000,'\n');

SendIFC(GPIB0); // Resets the GPIB interface

Address[0]=19; // Signal generator's address

Address[1]=NOADDR; // Signifies end element in array. Defined in

// DECL-32.H

Advertising
This manual is related to the following products: