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 #341 background imageLoading...
Page #341 background image
Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide 331
Creating and Downloading User-Data Files
Save and Recall Instrument State Files
string catalog = ReadDevice(device);
/* Match the catalog listing for state files which are named
(sequence#)_(register#) e.g. 0_01, 1_01, 2_05*/
Match m = Regex.Match(catalog, "\"(\\d_\\d\\d),");
while (m.Success)
{
// Grab the matched filename from the regular expresssion
string nextFile = m.Groups[1].ToString();
// Retrieve the file and store with a .STA extension
// in the current directory
Console.WriteLine("Retrieving state file: " + nextFile);
WriteDevice(device, "MEM:DATA? \"/USER/STATE/" + nextFile + "\"\n", true);
ReadFileBlock(device, nextFile + ".STA");
// Clear newline
ReadDevice(device);
// Advance to next match in catalog string
m = m.NextMatch();
}
}
/* This method writes an ASCII text string (SCPI command) to the signal generator.
If the bool "sendEnd" is true, the END line character will be sent at the
conclusion of the write. If "sendEnd is false the END line will not be sent.*/
static public void WriteDevice(uint device, string scpiCmd, bool sendEnd)
{
byte[] buf = Encoding.ASCII.GetBytes(scpiCmd);
if (!sendEnd) // Do not send the END line character
{
VisaInterop.SetAttribute(device, VisaAttribute.SendEndEnable, 0);
}
uint retCount;
VisaInterop.Write(device, buf, (uint)buf.Length, out retCount);
if (!sendEnd) // Set the bool sendEnd true.
{
VisaInterop.SetAttribute(device, VisaAttribute.SendEndEnable, 1);
}
}
// This method reads an ASCII string from the specified device
static public string ReadDevice(uint device)
{

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