
Chapter 3
137
Programming Examples
Saving and Recalling Instrument State Data
Example:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include "visa.h"
void main ()
{
/*program variables*/
ViSession defaultRM, viVSA;
ViStatus viStatus = 0;
long lComplete = 0;
/*open session to GPIB device at address 18 */
viStatus=viOpenDefaultRM (&defaultRM);
viStatus=viOpen (defaultRM, "GPIB0::18::INSTR",
VI_NULL,VI_NULL, &viVSA);
/*check opening session sucess*/
if(viStatus)
{
printf("Could not open a session to GPIB device at
address 18!\n");
exit(0);
}
/*reset the instrument */
viPrintf(viVSA, "*RST\n");
/*set the input port to the internal 50Mhz reference
source*/
viPrintf(viVSA, "SENS:FEED AREF\n");
/*zoom the spectrum display*/
viPrintf(viVSA, "DISP:FORM:ZOOM1\n");
/*tune the instrument to 50MHZ*/
viPrintf(viVSA, "SENS:FREQ:CENT 50E6\n");
/*change the resolution bandwidth*/
viPrintf(viVSA, "SENS:SPEC:BAND:RES 100E3\n");
/*change the Y Axis Scale/Div*/
viPrintf(viVSA, "DISP:SPEC:WIND:TRAC:Y:SCAL:PDIV 5\n");
/*Change the display refernece level*/
viPrintf(viVSA, "DISP:SPEC:WIND:TRAC:Y:SCAL:RLEV
-15\n");
/*trigger the instrument*/
viPrintf(viVSA, "INIT:IMM;*OPC?\n");
/*poll the operation complete query*/
while (!lComplete)
viScanf (viVSA,"%d",&lComplete);
/*save this state in register 10.
Содержание E4406A VSA Series
Страница 4: ...4 ...
Страница 59: ...59 2 Programming Fundamentals ...
Страница 76: ...76 Chapter2 Programming Fundamentals Using the Instrument Status Registers Overall Status Register System ...
Страница 124: ...124 Chapter2 Programming Fundamentals Using the LAN to Control the Analyzer ...
Страница 125: ...125 3 Programming Examples ...
Страница 164: ...164 Chapter3 Programming Examples Using Java Programming Over Socket LAN ...
Страница 165: ...165 4 Programming Command Cross References ...
Страница 379: ...379 6 Error Messages ...
Страница 412: ...412 Chapter6 Error Messages Error Message Descriptions ...