AnsweredAssumed Answered

33521A LoadArbWaveform fails with more than 64k points

Question asked by patrik73 on Apr 27, 2011
Latest reply on Aug 11, 2011 by hognala
Hi,

I need to download arbitrary waveforms with more than 200k samples to volatile memory and tried to use the method LoadArbWaveform(). Unfortunately the device reports the error "Out of memory" (error code -321) when I download more than 65536 samples. Up to 64 ksamples everything works fine. Any ideas?

Here my test code:

        private static void load_waveform()
        {
            Agilent.Ag3352x.Interop.Ag3352x driver = null;
            try
            {
                // Create driver instance
                driver = new Agilent.Ag3352x.Interop.Ag3352x();

                string resourceDesc = "33521A";
                string initOptions = "QueryInstrStatus=true, Simulate=false, DriverSetup= Model=, Trace=false";
                bool idquery = true;
                bool reset = true;

                // Initialize the driver
                driver.Initialize(resourceDesc, idquery, reset, initOptions);

                // Create waveform
                System.String name = "test1";
                double[] data = new double[64 * 1024 + 1];
                for (int idx = 0; idx < data.Length; idx++)
                {
                    data&#91;idx&#93; = Math.Sin((double)idx / 100);
                }

                // Download waveform
                Agilent.Ag3352x.Interop.Ag3352xChannel pAg3352xChannel = driver.Channels.get_Item("Channel1");
                pAg3352xChannel.OutputFunction.ArbitraryWaveform.Clear();
                pAg3352xChannel.OutputFunction.ArbitraryWaveform.LoadArbWaveform(name, data);

                // Enable output
                pAg3352xChannel.OutputFunction.ArbitraryWaveform.SelectArbWaveform(name);
                pAg3352xChannel.Output.Voltage.Amplitude = 2.0;
                pAg3352xChannel.Output.Voltage.Offset.DCOffset = 0.0;
                pAg3352xChannel.Output.Enabled = true;

                int errorNum = -1;
                string errorMsg = null;
                driver.Utility.ErrorQuery(ref errorNum, ref errorMsg);
                Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                int errorNum = -1;
                string errorMsg = null;
                driver.Utility.ErrorQuery(ref errorNum, ref errorMsg);
                Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg);
            }
            finally
            {
                if (driver != null && driver.Initialized)
                {
                    // Close driver
                    driver.Close();
                }
            }
        }

Outcomes