EasyManuals Logo

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 #342 background imageLoading...
Page #342 background image
332 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Creating and Downloading User-Data Files
Save and Recall Instrument State Files
string retValue = "";
byte[] buf = new byte[MAX_READ_DEVICE_STRING]; // 1024 bytes maximum read
uint retCount;
if (VisaInterop.Read(device, buf, (uint)buf.Length -1, out retCount) == 0)
{
retValue = Encoding.ASCII.GetString(buf, 0, (int)retCount);
}
return retValue;
}
/* The following method reads a SCPI definite block from the signal generator
and writes the contents to a file on your computer. The trailing
newline character is NOT consumed by the read.*/
static public void ReadFileBlock(uint device, string fileName)
{
// Create the new, empty data file.
FileStream fs = new FileStream(fileName, FileMode.Create);
// Read the definite block header: #{lengthDataLength}{dataLength}
uint retCount = 0;
byte[] buf = new byte[10];
VisaInterop.Read(device, buf, 2, out retCount);
VisaInterop.Read(device, buf, (uint)(buf[1]-'0'), out retCount);
uint fileSize = UInt32.Parse(Encoding.ASCII.GetString(buf, 0, (int)retCount));
// Read the file block from the signal generator
byte[] readBuf = new byte[TRANSFER_BLOCK_SIZE];
uint bytesRemaining = fileSize;
while (bytesRemaining != 0)
{
uint bytesToRead = (bytesRemaining < TRANSFER_BLOCK_SIZE) ?
bytesRemaining : TRANSFER_BLOCK_SIZE;
VisaInterop.Read(device, readBuf, bytesToRead, out retCount);
fs.Write(readBuf, 0, (int)retCount);
bytesRemaining -= retCount;
}
// Done with file
fs.Close();
}
/* The following method writes the contents of the specified file to the
specified file in the form of a SCPI definite block. A newline is

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