I have a function to get Osciloscope screenshot.
Following is my code segment:
string visaRsrcAddr = "TCPIP0::" + IP.ToString() + "::inst0::INSTR";
var scope = GlobalResourceManager.Open(visaRsrcAddr) as IMessageBasedSession;
using (scope)
{
scope.TimeoutMilliseconds = 60000;
scope.FormattedIO.WriteLine("SAVE:IMAGe \"eval.png\"");
scope.FormattedIO.WriteLine("*OPC?");
((IMessageBasedSession)(scope)).TerminationCharacterEnabled = false;
scope.FormattedIO.WriteLine("FILESystem:READFile \"eval.png\"");
byte[] imgData = new byte[30000000];
// Giving a large value for count to make sure all bytes are read.
imgData = scope.RawIO.Read(30000000);
scope.FormattedIO.WriteLine("*OPC?");
This is throwing Timeout exception very often. What could be the reason?
Thanks in advance,
Reena
// Save image data to local disk
File.WriteAllBytes(fileName, imgData);
// Image data has been transferred to PC and saved. Delete image file from instrument's hard disk.
scope.FormattedIO.WriteLine("FILESystem:DELEte \"eval.png\"");