Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with getting measurements using rsspecan C# wrapper

I'm working with FSP3 spectrum analyzer. I'm trying to get amplitude-frequency characteristic, here's the code:

            string resource = "ASRL1::INSTR";
            rsspecan device = null;
            try
            {
                device = new rsspecan(resource, false, false);
               
                int points;
                double[] amplitude = new double[5000];
                device.ReadYTrace(1, 1, 5000, 5000, out points, amplitude);

                foreach (var item in amplitude)
                    Console.Write("{0} ", item);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                if (device != null)
                    device.Dispose();
                Console.ReadKey();
            }

The driver returns an error:

Primary Error: (Hex 0xBFFF003A) Unable to start operation because setup is invalid (due to attributes being set to an inconsistent state).

 

At the same time this code is working properly:

 

                int result = device.ConfigureFrequencyCenter(1, 2.0e9);
                result = device.ConfigureFrequencyStartStop(1, 1.0, 3.0e9);

How can I fix this problem? Maybe I'm doing something wrong? Thanks.

0 Kudos
Message 1 of 1
(3,534 Views)