Example #1
0
        //create input struct
        public void ExportData(ExportDataStruct export_data_struct)
        {
            //channels
            const String all_channels_option      = ", ALL_CHANNELS";
            const String specific_channels_option = ", SPECIFIC_CHANNELS";

            //time span
            const String all_time_option       = ", ALL_TIME";
            const String time_span_option      = ", TIME_SPAN";
            const String timing_markers_option = ", TIMING_MARKERS";

            const String csv_option            = ", CSV";
            const String headers_option        = ", HEADERS";
            const String no_headers_option     = ", NO_HEADERS";
            const String tab_option            = ", TAB";
            const String comma_option          = ", COMMA";
            const String sample_number_option  = ", SAMPLE_NUMBER";
            const String time_stamp_option     = ", TIME_STAMP";
            const String combined_option       = ", COMBINED";
            const String separate_option       = ", SEPARATE";
            const String row_per_change_option = ", ROW_PER_CHANGE";
            const String row_per_sample_option = ", ROW_PER_SAMPLE";
            const String dec_option            = ", DEC";
            const String hex_option            = ", HEX";
            const String bin_option            = ", BIN";
            const String ascii_option          = ", ASCII";

            const String binary_option      = ", BINARY";
            const String each_sample_option = ", EACH_SAMPLE";
            const String on_change_option   = ", ON_CHANGE";

            const String vcd_option = ", VCD";


            String export_command = export_data_cmd;

            export_command += ", " + export_data_struct.FileName;

            if (export_data_struct.ExportAllChannels == true)
            {
                export_command += all_channels_option;
            }
            else
            {
                export_command += specific_channels_option;
                foreach (int channel in export_data_struct.ChannelsToExport)
                {
                    export_command += ", " + channel.ToString();
                }
            }


            if (export_data_struct.SamplesRangeType == DataExportSampleRangeType.RangeAll)
            {
                export_command += all_time_option;
            }
            else if (export_data_struct.SamplesRangeType == DataExportSampleRangeType.RangeTimes)
            {
                export_command += time_span_option;
                export_command += ", " + export_data_struct.StartingTime;
                export_command += ", " + export_data_struct.EndingTime;
            }
            else if (export_data_struct.SamplesRangeType == DataExportSampleRangeType.RangeMarkers)
            {
                export_command += timing_markers_option;
            }


            if (export_data_struct.DataExportType == DataExportType.ExportCsv)
            {
                export_command += csv_option;

                if (export_data_struct.CsvIncludeHeaders == CsvHeadersType.CsvIncludesHeaders)
                {
                    export_command += headers_option;
                }
                else if (export_data_struct.CsvIncludeHeaders == CsvHeadersType.CsvNoHeaders)
                {
                    export_command += no_headers_option;
                }

                if (export_data_struct.CsvDelimiterType == CsvDelimiterType.CsvTab)
                {
                    export_command += tab_option;
                }
                else if (export_data_struct.CsvDelimiterType == CsvDelimiterType.CsvComma)
                {
                    export_command += comma_option;
                }

                if (export_data_struct.CsvTimestampType == CsvTimestampType.CsvSample)
                {
                    export_command += sample_number_option;
                }
                else if (export_data_struct.CsvTimestampType == CsvTimestampType.CsvTime)
                {
                    export_command += time_stamp_option;
                }

                if (export_data_struct.CsvOutputMode == CsvOutputMode.CsvSingleNumber)
                {
                    export_command += combined_option;
                }
                else if (export_data_struct.CsvOutputMode == CsvOutputMode.CsvOneColumnPerBit)
                {
                    export_command += separate_option;
                }

                if (export_data_struct.CsvDensity == CsvDensity.CsvTransition)
                {
                    export_command += row_per_change_option;
                }
                else if (export_data_struct.CsvDensity == CsvDensity.CsvComplete)
                {
                    export_command += row_per_sample_option;
                }

                if (export_data_struct.CsvDisplayBase == CsvBase.CsvDecimal)
                {
                    export_command += dec_option;
                }
                else if (export_data_struct.CsvDisplayBase == CsvBase.CsvHexadecimal)
                {
                    export_command += hex_option;
                }
                else if (export_data_struct.CsvDisplayBase == CsvBase.CsvBinary)
                {
                    export_command += bin_option;
                }
                else if (export_data_struct.CsvDisplayBase == CsvBase.CsvAscii)
                {
                    export_command += ascii_option;
                }
            }
            else if (export_data_struct.DataExportType == DataExportType.ExportBinary)
            {
                export_command += binary_option;

                if (export_data_struct.BinaryOutputMode == BinaryOutputMode.BinaryEverySample)
                {
                    export_command += each_sample_option;
                }
                else if (export_data_struct.BinaryOutputMode == BinaryOutputMode.BinaryEveryChange)
                {
                    export_command += on_change_option;
                }

                if (export_data_struct.BinaryOutputWordSize == BinaryOutputWordSize.Binary8Bit)
                {
                    export_command += ", 8";
                }
                else if (export_data_struct.BinaryOutputWordSize == BinaryOutputWordSize.Binary16Bit)
                {
                    export_command += ", 16";
                }
                else if (export_data_struct.BinaryOutputWordSize == BinaryOutputWordSize.Binary32Bit)
                {
                    export_command += ", 32";
                }
                else if (export_data_struct.BinaryOutputWordSize == BinaryOutputWordSize.Binary64Bit)
                {
                    export_command += ", 64";
                }
            }
            else if (export_data_struct.DataExportType == DataExportType.ExportVcd)
            {
                export_command += vcd_option;
            }


            WriteString(export_command);

            String response = "";

            GetResponse(ref response);
        }
Example #2
0
        public void Test()
        {
            GetConnectedDevices();
            SelectActiveDevice(1);
            int[] inputs = GetInputs();
            if (inputs != null)
            {
                for (int i = 0; i < inputs.Length; ++i)
                {
                    StringHelper.Write(inputs[i].ToString());
                }
            }
            GetConnectedDevices();
            Capture();
            {
                ExportDataStruct ex_data_struct = new ExportDataStruct();
                ex_data_struct.FileName          = @"C:\Users\Chris\Desktop\test";
                ex_data_struct.SamplesRangeType  = DataExportSampleRangeType.RangeAll;
                ex_data_struct.ExportAllChannels = true;
                ex_data_struct.DataExportType    = DataExportType.ExportVcd;
                ExportData(ex_data_struct);
            }
            {
                ExportDataStruct ex_data_struct = new ExportDataStruct();
                ex_data_struct.FileName          = @"C:\Users\Chris\Desktop\test";
                ex_data_struct.SamplesRangeType  = DataExportSampleRangeType.RangeTimes;
                ex_data_struct.StartingTime      = 0;
                ex_data_struct.EndingTime        = 0.000145;
                ex_data_struct.ExportAllChannels = false;
                ex_data_struct.ChannelsToExport  = new int[] { 1, 4, 7 };
                ex_data_struct.DataExportType    = DataExportType.ExportCsv;
                ex_data_struct.CsvDelimiterType  = CsvDelimiterType.CsvTab;
                ex_data_struct.CsvDensity        = CsvDensity.CsvComplete;
                ex_data_struct.CsvDisplayBase    = CsvBase.CsvDecimal;
                ex_data_struct.CsvIncludeHeaders = CsvHeadersType.CsvNoHeaders;
                ex_data_struct.CsvOutputMode     = CsvOutputMode.CsvOneColumnPerBit;
                ex_data_struct.CsvTimestampType  = CsvTimestampType.CsvSample;
                ExportData(ex_data_struct);
            }
            Trigger[] trigger1 = { Trigger.High, Trigger.Low, Trigger.Low, Trigger.Low, Trigger.High, Trigger.High, Trigger.High, Trigger.High };
            SetTrigger(trigger1);
            SelectActiveDevice(2);
            GetConnectedDevices();
            ResetActiveLogic16Channels();
            Trigger[] trigger2 = { Trigger.High, Trigger.Low, Trigger.Low, Trigger.Low, Trigger.High, Trigger.High, Trigger.High, Trigger.High, Trigger.High, Trigger.Low, Trigger.Low, Trigger.Low, Trigger.High, Trigger.High, Trigger.High, Trigger.High };
            SetTrigger(trigger2);
            SetNumSamples(2000000);
            SetSampleRate(16000000);
            Trigger[] trigger_reset = { Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None, Trigger.None };
            SetTrigger(trigger_reset);
            CaptureToFile(@"C:\Users\Chris\Desktop\test.logicdata");
            LoadFromFile(@"C:\Users\Chris\Desktop\test.logicdata");
            Capture();
            SaveToFile(@"C:\Users\Chris\Desktop\test.logicdata");
            ResetActiveLogic16Channels();
            LoadFromFile(@"C:\Users\Chris\Desktop\test.logicdata");

            GetAnalyzers();
            //ExportAnalyzers( 1 , @"c:\Users\Chris\Desktop\test.txt", true );

            SetCapturePretriggerBufferSize(1000000);
            StringHelper.WriteLine(GetCapturePretriggerBufferSize().ToString());
            SetCapturePretriggerBufferSize(10000000);
            ResetActiveLogic16Channels();
            int[] channels = GetActiveLogic16Channels();
            if (channels != null)
            {
                for (int i = 0; i < channels.Length; ++i)
                {
                    StringHelper.Write(channels[i].ToString());
                }
            }
            int[] active_channels = { 1, 4, 6, 10, 13 };
            SetActiveLogic16Channels(active_channels);
            int[] channels_2 = GetActiveLogic16Channels();
            if (channels_2 != null)
            {
                for (int i = 0; i < channels_2.Length; ++i)
                {
                    StringHelper.Write(channels_2[i].ToString());
                }
            }
        }