EasyManuals Logo
Home>Agilent Technologies>Portable Generator>N5182A

Agilent Technologies N5182A Programming Guide

Agilent Technologies N5182A
366 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #146 background imageLoading...
Page #146 background image
136 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Programming Examples
RS-232 Programming Interface Examples (ESG/PSG/E8663B Only)
ViSessiondefaultRM, instr;// Declares type ViSession variables
ViUInt32retCount; // Return count for string I/O
ViCharbuffer[MAX_COUNT];// Buffer for string I/O
status = viOpenDefaultRM(&defaultRM);// Initializes the system
// Open communication with Serial Port 2
status = viOpen(defaultRM, "ASRL2::INSTR", VI_NULL, VI_NULL, &instr);
if(status){// If problems, then prompt user
printf("Could not open ViSession!\n");
printf("Check instruments and connections\n");
printf("\n");
exit(0);}
// Set timeout for 5 seconds
viSetAttribute(instr, VI_ATTR_TMO_VALUE, 5000);
// Asks for sig gen ID string
status = viWrite(instr, (ViBuf)"*IDN?\n", 6, &retCount);
// Reads the sig gen response
status = viRead(instr, (ViBuf)buffer, MAX_COUNT, &retCount);
buffer[retCount]= '\0';// Indicates the end of the string
printf("Signal Generator ID: "); // Prints header for ID
printf(buffer);// Prints the ID string to the screen
printf("\n");// Prints carriage return
// Flush the read buffer
// Sets sig gen power to -5dbm
status = viWrite(instr, (ViBuf)"POW:AMPL -5dbm\n", 15, &retCount);
// Querys the sig gen for power level
status = viWrite(instr, (ViBuf)"POW?\n",5,&retCount);
// Read the power level
status = viRead(instr, (ViBuf)buffer, MAX_COUNT, &retCount);
buffer[retCount]= '\0';// Indicates the end of the string
printf("Power level = ");// Prints header to the screen
printf(buffer);// Prints the queried power level
printf("\n");
status = viClose(instr);// Close down the system
status = viClose(defaultRM);
return 0;
}

Table of Contents

Other manuals for Agilent Technologies N5182A

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Agilent Technologies N5182A and is the answer not in the manual?

Agilent Technologies N5182A Specifications

General IconGeneral
BrandAgilent Technologies
ModelN5182A
CategoryPortable Generator
LanguageEnglish

Related product manuals