Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 375
Creating and Downloading User–Data Files
Save and Recall Instrument State Files
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
NOT appended to the block and END is not sent at the conclusion of
the
write.*/
static public void WriteFileBlock(uint device, string fileName)
{
// Make sure that the file exists, otherwise sends a null block
if (File.Exists(fileName))
{
FileStream fs = new FileStream(fileName, FileMode.Open);
// Send the definite block header:
#{lengthDataLength}{dataLength}
string fileSize = fs.Length.ToString();
string fileSizeLength = fileSize.Length.ToString();
WriteDevice(device, "#" + fileSize fileSize, false);
// Don't set END at the end of writes
VisaInterop.SetAttribute(device, VisaAttribute.SendEndEnable,
0);
// Write the file block to the signal generator
byte[] readBuf = new byte[TRANSFER_BLOCK_SIZE];
int numRead = 0;
uint retCount = 0;
while ((numRead = fs.Read(readBuf, 0, TRANSFER_BLOCK_SIZE)) !=
0)
{
Содержание X-Series
Страница 4: ...4 ...
Страница 10: ...10 Contents ...