Keysight E4428C ESG RF Programming Manual page 379

Signal generators
Table of Contents

Advertisement

string catalog = ReadDevice(device);
/* Match the catalog listing for state files which are named
(sequence#)_(register#)
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)
{
Keysight Signal Generators Programming Guide
e.g.
0_01, 1_01, 2_05*/
Creating and Downloading User–Data Files
Save and Recall Instrument State Files
371

Advertisement

Table of Contents
loading

Table of Contents