Programming Examples
GPIB Programming Interface Examples
{
ViSession defaultRM, vi;
ViStatus viStatus = 0;
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM, "GPIB::19::INSTR", VI_NULL, VI_NULL, &vi);
if(viStatus){
printf("Could not open ViSession!\n");
printf("Check instruments and connections\n");
printf("\n");
exit(0);}
viPrintf(vi, "*RST\n");
printf("The signal generator should now be in REMOTE. The remote
printf("annunciator R should appear on the signal generator display\n");
printf("\n");
viClose(vi);
viClose(defaultRM);
}
Local Lockout Using HP Basic and GPIB
This example demonstrates the Local Lockout function. Local Lockout disables the front panel signal
generator keys. basicex2.txt performs the following functions:
• resets instrument
• places signal generator into local
• places signal generator into remote
The following program example is available on the signal generator Documentation CD- ROM as
basicex2.txt.
10
!*************************************************************************
20
!
30
!
PROGRAM NAME:
40
!
50
!
PROGRAM DESCRIPTION:
60
!
70
!
80
!
90
!
100
!
86
// Declares a variable of type ViSession
// for instrument communication
// Opens a session to the GPIB device
// at address 19
// initializes signal generator
// prints to the output window
// closes session
// closes default session
basicex2.txt
In REMOTE mode, access to the signal generators
functional front panel keys are disabled except for
the Local and Contrast keys.
command will disable the Local key.
The LOCAL command, executed from the controller, is then
the only way to return the signal generator to front panel,
The LOCAL LOCKOUT
Keysight Signal Generators Programming Guide
indicator\n");