Esempio n. 1
0
        static void Main(string[] args)
        {
            Ag53230A instr = new Ag53230A();

            if (args.Length > 0)
            {
                instr.WriteString(args[0]);
                if (!args[0].Contains("?"))
                {
                    Console.WriteLine("Not a query.");     // Queries usually ends with ?, but at least contains ? ("TRIG:SOUR?", ":DATA:REM? 1,WAIT")
                    return;
                }
            }
            else
            {
                return;
            }

            String str = instr.ReadString();

            String[] res = str.Split(new char[] { ',' });

            foreach (string r in res)
            {
                Console.WriteLine(r);
            }

            // Write errorlog - if any.
            string[] errors = instr.ReadErrors();
            foreach (string error in errors)
            {
                Console.Error.WriteLine(error);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Ag53230A instr = new Ag53230A();

            string[] errors = instr.ReadErrors();
            foreach (string error in errors)
            {
                Console.Error.WriteLine(error);
            }
        }
Esempio n. 3
0
        /*
         *  TO-DO:
         * Add option -a to show all settings, even if they are the default
         * Add option to show "protected" settings? "ROSC:*"
         */
        static void Main(string[] args)
        {
            Ag53230A instr = new Ag53230A();

            List <string> input = new List <string>();

            // If input is redirected, assume it is from a file we want to upload to the instrument.
            if (Console.IsInputRedirected)
            {
                input.Add(Console.In.ReadToEnd());
            }

            // If arguments are given, assume it is strings to be sent to the instrument
            input.AddRange(args);

            // Send whatever we got.
            foreach (string s in input)
            {
                string[] stmts = s.Split(new char[] { ';', '\n' });

                foreach (string stmt in stmts)
                {
                    instr.WriteString(stmt.Trim());
                }
            }


            // If no input, get current configuration state from instrument
            if (input.Count == 0)
            {
                instr.WriteString("*LRN?");
                string s = instr.ReadString();
                s = s.Trim();
                string[] stmts = s.Split(new char[] { ';' });

                // Filter out default settings
                foreach (string stmt in stmts)
                {
                    if (!Defaultsettings.Contains(stmt))
                    {
                        Console.WriteLine(stmt + ";");
                    }
                }
            }


            // If errors, print.
            string[] errors = instr.ReadErrors();
            foreach (string error in errors)
            {
                Console.Error.WriteLine(error);
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Ag53230A instr = new Ag53230A();

            instr.LearnConfig();

            int repeat = -1;

            if (args.Length > 0)
            {
                if (!Int32.TryParse(args[0], out repeat))
                {
                    Console.Error.WriteLine("Warning! Unable to parse argument {0}", args[0]);
                }
            }

            while (repeat == -1 || repeat-- > 0)
            {
                instr.WriteString("READ?");

                double[] res = instr.GetReadings();

                foreach (double d in res)
                {
                    Console.WriteLine(d.ToString());    // Todo: formatstring
                }

                //String str = instr.ReadString().Trim();

                //String[] readings = str.Split(new char[] { ',' });

                //foreach (string r in readings)
                //    Console.WriteLine(r);
            }

            string[] errors = instr.ReadErrors();
            foreach (string error in errors)
            {
                Console.Error.WriteLine(error);
            }
        }