Technical data
Creating and Downloading User-Data Files 5
Agilent N8211A/N8212A Performance Upconverter Synthetic Instrument Module, 250 kHz to 20 / 40 GHz 143
// Send the definite block header: #{lengthDataLength}{dataLength}
string fileSize = fs.Length.ToString();
string fileSizeLength = fileSize.Length.ToString();
WriteDevice(device, "#" + fileSizeLength + 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)
{
VisaInterop.Write(device, readBuf, (uint)numRead, out retCount);
}
// Go ahead and set END on writes
VisaInterop.SetAttribute(device, VisaAttribute.SendEndEnable, 1);
// Done with file
fs.Close();
}
else
{
// Send an empty definite block
WriteDevice(device, "#10", false);
}
}
}
// Declaration of VISA device access constants
public enum VisaAccessMode
{