Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Does VISA.NET API has a equivalent for VisaNS.ReadToFile() function

I am working on getting a hardcopy from a scope, but don't know how to set the buffer size when getting the image data.

I found the following example which using the MessageBasedSession.ReadToFile() function to streamline the instrument read and file write to a single function call. I want to use the VISA.NET API, Is there a equivalent function in VISA.NET API or any other ways to set a proper buffer size before knowing  the size of the file?

Thanks in advance!





using System;
using NationalInstruments.VisaNS;

namespace instr_control
    public class Program
        static void Main(string[] args)
            MessageBasedSession Scope;
            string resourceString = "USB0::0x0699::0x03A6::C010000::INSTR";
            Scope = (MessageBasedSession)ResourceManager.GetLocalManager().Open(resourceString);
            string path = @"C:\";
            string fname = @"temp" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".bmp";

            Scope.Timeout = 5000;
            Scope.Write("ACQuire:STATE STOP");
            Scope.Write("HardCopy:FormatException bmp");
            Scope.Write("Hardcopy:Layout Portrait");
            Scope.Write("HARDCopy:INKSaver OFF");
            Scope.Write("Hardcopy:port USB");
            Scope.Write("Hardcopy Start");
                Scope.ReadToFileAppends = true;
                    Scope.ReadToFile(path + fname);
                while (Scope.LastStatus.Equals(VisaStatusCode.SuccessMaxCountRead)) ;

            catch (Exception exp)





0 Kudos
Message 1 of 1