Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

C# program - VISA library - Network vector analyzer

Hi everybody. I am new in this forum. I hope we can exchange our knowledge.

It's very hard to find what I need: i.e. , a simple communication with network vector analyzer in C#.

I am trying to write a C# program to memorize the NVA trace in a C# vector. There are many commands that work, except the ones that allow me to manage the trace.

In the Visual Studio 2019 environment this command: “str.WriteString (" CALC:DATA? FDAT "); ", display this error:

“RohdeSchwarz.RsInstrument.InstrumentStatusException: ''TCPIP0::192.168.1.10::hislip0': Instrument error detected: Query interrupted'  ”

At the same time the NVA shows this generic error: “Remote error -410: Query interrrupted”

) How can I fix it?

) How can I store a trace of the NVA in a C# vector?

) Can you suggest me a manual for programming in C# with NI-VISA library for NVA?

Thanks

 

The test code:

using System;

using System.Collections.Generic;

using System.Diagnostics;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using RohdeSchwarz.RsInstrument;

 

namespace RsInstrument_Hello_World_Example

{

    class Program

    {

        static void Main()

        {

            RsInstrument instr;

            RsInstrument.AssertMinVersion("1.10.1");

            try             {

                instr = new RsInstrument("TCPIP0::192.168.1.10::hislip0");

 

            }

            catch (RsInstrumentException e)

            {

                Console.WriteLine($"Error initializing the instrument session:\n{e.Message}");

                Console.WriteLine("Press any key to finish.");

                Console.ReadKey();

                return;

            }        

            instr.WriteString("*RST");

            instr.WriteString("CALC:PAR:SDEF 'Trc1','S21'");

            instr.WriteString("DISP:WIND:TRAC:FEED 'Trc1'");

            instr.WriteString("CALC:DATA? FDAT");//<----- this line doesn't work!

            instr.Dispose();

        }

    }

}

0 Kudos
Message 1 of 2
(1,655 Views)

I don't have any experience with RS  NVAs but I just remark that the error is generated from a call to a custom RS class library (RohdeSchwarz.RsInstrument) working on top of VISA. So the error 410 looks like an error condition defined in this library, not a VISA error. I would suggest to try without the library, calling the standard VISA functions.  

 

0 Kudos
Message 2 of 2
(1,514 Views)