Esempio n. 1
0
        /****************************************************************************
         * CollectStreamingTriggered
         *  this function demonstrates how to collect a stream of data
         *  from the unit (start collecting on trigger)
         ***************************************************************************/
        void CollectStreamingTriggered()
        {
            short triggerVoltage = mv_to_adc( 1000, (short) _channelSettings[(int) Imports.Channel.ChannelA].range); // ChannelInfo stores ADC counts

              Imports.TriggerChannelProperties[] sourceDetails = new Imports.TriggerChannelProperties[] {
            new Imports.TriggerChannelProperties( triggerVoltage, 256 * 10, triggerVoltage, 256 * 10, Imports.Channel.ChannelA, Imports.ThresholdMode.Level )};

              Imports.TriggerConditions[] conditions = new Imports.TriggerConditions[] {
              new Imports.TriggerConditions(Imports.TriggerState.True,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare)};

              Imports.ThresholdDirection[] directions = new Imports.ThresholdDirection[]
                                            { Imports.ThresholdDirection.Rising,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None };

              Console.WriteLine("Collect streaming triggered...");
              Console.WriteLine("Data is written to disk file (stream.txt)");
              Console.WriteLine("Press a key to start");
              WaitForKey();
              SetDefaults();

              /* Trigger enabled
               * Rising edge
               * Threshold = 100mV */

              SetTrigger(sourceDetails, 1, conditions, 1, directions, null, 0, 0, 0);

              StreamDataHandler(100000);
        }
Esempio n. 2
0
        /****************************************************************************
         * CollectBlockTriggered
         *  this function demonstrates how to collect a single block of data from the
         *  unit, when a trigger event occurs.
         ****************************************************************************/
        void CollectBlockTriggered()
        {
            short triggerVoltage = mv_to_adc(1000, (short)_channelSettings[(int)Imports.Channel.ChannelA].range); // ChannelInfo stores ADC counts

               Imports.TriggerChannelProperties[] sourceDetails = new Imports.TriggerChannelProperties[] {
            new Imports.TriggerChannelProperties(triggerVoltage,
                                             256*10,
                                             triggerVoltage,
                                             256*10,
                                             Imports.Channel.ChannelA,
                                             Imports.ThresholdMode.Level)};

              Imports.TriggerConditions[] conditions = new Imports.TriggerConditions[] {
              new Imports.TriggerConditions(Imports.TriggerState.True,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare,
                                            Imports.TriggerState.DontCare)};

              Imports.ThresholdDirection[] directions = new Imports.ThresholdDirection[]
                                            { Imports.ThresholdDirection.Rising,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None,
                                            Imports.ThresholdDirection.None };

              Console.WriteLine("Collect block triggered...");
              Console.WriteLine("Collects when value rises past {0}mV",
                        adc_to_mv(sourceDetails[0].ThresholdMajor,
                                  (int)_channelSettings[(int)Imports.Channel.ChannelA].range));
              Console.WriteLine("Press a key to start...");
              WaitForKey();

              SetDefaults();

              /* Trigger enabled
               * Rising edge
               * Threshold = 100mV */
              SetTrigger(sourceDetails, 1, conditions, 1, directions, null, 0, 0, 0);

              BlockDataHandler("Ten readings after trigger", 0);
        }