36 Chapter 2
Programming Examples
GPIB Programming Examples
360 PRINT
370 PRINT "Verify that the signal generator's front-panel keyboard is functional."
380 PRINT
390 PRINT "To re-start this program press RUN."
400 END
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. This example
is available on the PSG 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