/// <summary>
        /// Create an object that represents one of the four outputs from an analog trigger.
        /// </summary>
        /// <remarks>Because this class derives from DigitalSource, it can be passed into
	    /// routing functions for Counter, Encoder, etc.</remarks>
        /// <param name="trigger">The trigger for which this is an output.</param>
        /// <param name="outputType">An enum that specifies the output on the trigger to represent.</param>
        public AnalogTriggerOutput(AnalogTrigger trigger, AnalogTriggerType outputType)
        {
            if (trigger == null)
                throw new NullReferenceException("Analog Trigger give was null");
            m_trigger = trigger;
            m_outputType = outputType;
            
            HAL.Report(ResourceType.kResourceType_AnalogTriggerOutput, (byte) trigger.Index, (byte) outputType);
        }
        /// <summary>
        /// Create an object that represents one of the four outputs from an analog trigger.
        /// </summary>
        /// <remarks>Because this class derives from DigitalSource, it can be passed into
	    /// routing functions for Counter, Encoder, etc.</remarks>
        /// <param name="trigger">The trigger for which this is an output.</param>
        /// <param name="outputType">An enum that specifies the output on the trigger to represent.</param>
        public AnalogTriggerOutput(AnalogTrigger trigger, AnalogTriggerType outputType)
        {
            if (trigger == null)
                throw new ArgumentNullException(nameof(trigger), "Analog Trigger given was null");
            m_trigger = trigger;
            m_outputType = outputType;

            HAL.Base.HAL.Report(ResourceType.kResourceType_AnalogTriggerOutput, (byte)trigger.Index, (byte)outputType);
        }
示例#3
0
 /// <summary>
 /// Sets the down source for the counter as a <see cref="AnalogTrigger"/>.
 /// </summary>
 /// <param name="analogTrigger">The AnalogTrigger object that is used for the down source.</param>
 /// <param name="triggerType">The anlog trigger output that will trigger the counter.</param>
 public void SetDownSource(AnalogTrigger analogTrigger, AnalogTriggerType triggerType)
 {
     if (analogTrigger == null)
     {
         throw new ArgumentNullException(nameof(analogTrigger), "Analog Trigger given was null");
     }
     SetDownSource(analogTrigger.CreateOutput(triggerType));
     m_allocatedDownSource = true;
 }
示例#4
0
 /// <summary>
 /// Create an instance of a Counter object, using an AnalogTrigger.
 /// </summary>
 /// <remarks>
 /// Uses the trigger state output from the analog trigger.
 /// <para>The counter will start counting immediately.</para>
 /// </remarks>
 /// <param name="trigger">The <see cref="AnalogTrigger"/> to count.</param>
 public Counter(AnalogTrigger trigger)
 {
     if (trigger == null)
     {
         throw new ArgumentNullException(nameof(trigger), "The Analog Trigger given was null");
     }
     InitCounter(Mode.TwoPulse);
     SetUpSource(trigger.CreateOutput(AnalogTriggerType.State));
 }
示例#5
0
        /// <summary>
        /// Create an object that represents one of the four outputs from an analog trigger.
        /// </summary>
        /// <remarks>Because this class derives from DigitalSource, it can be passed into
        /// routing functions for Counter, Encoder, etc.</remarks>
        /// <param name="trigger">The trigger for which this is an output.</param>
        /// <param name="outputType">An enum that specifies the output on the trigger to represent.</param>
        public AnalogTriggerOutput(AnalogTrigger trigger, AnalogTriggerType outputType)
        {
            if (trigger == null)
            {
                throw new ArgumentNullException(nameof(trigger), "Analog Trigger given was null");
            }
            m_trigger    = trigger;
            m_outputType = outputType;

            HAL.Base.HAL.Report(ResourceType.kResourceType_AnalogTriggerOutput, (byte)trigger.Index, (byte)outputType);
        }
示例#6
0
        public DutyCycleEncoder(DutyCycle dutyCycle)
        {
            m_dutyCycle     = dutyCycle;
            m_analogTrigger = new AnalogTrigger(m_dutyCycle);
            m_counter       = new UpDownCounter();

            m_simDevice = SimDevice.Create("DutyCycleEncoder", m_dutyCycle.FPGAIndex);

            if (m_simDevice)
            {
            }

            m_analogTrigger.SetLimitsDutyCycle(0.25, 0.75);
            m_counter.UpSource   = m_analogTrigger.CreateOutput(AnalogTriggerType.kRisingPulse);
            m_counter.DownSource = m_analogTrigger.CreateOutput(AnalogTriggerType.kFallingPulse);

            SendableRegistry.Instance.AddLW(this, "DutyCycle Encoder", m_dutyCycle.SourceChannel);
        }
示例#7
0
 public Counter(AnalogTrigger trigger)
 {
     if (trigger == null)
     {
         throw new ArgumentNullException(nameof(trigger), "The Analog Trigger given was null");
     }
     InitCounter(Mode.TwoPulse);
     SetUpSource(trigger.CreateOutput(AnalogTriggerType.State));
 }
示例#8
0
 public void SetDownSource(AnalogTrigger analogTrigger, AnalogTriggerType triggerType)
 {
     if (analogTrigger == null)
         throw new NullReferenceException("Analog Trigger given was null");
     SetDownSource(analogTrigger.CreateOutput(triggerType));
     m_allocatedDownSource = true;
 }
示例#9
0
 /// <summary>
 /// Sets the down source for the counter as a <see cref="AnalogTrigger"/>.
 /// </summary>
 /// <param name="analogTrigger">The AnalogTrigger object that is used for the down source.</param>
 /// <param name="triggerType">The anlog trigger output that will trigger the counter.</param>
 public void SetDownSource(AnalogTrigger analogTrigger, AnalogTriggerType triggerType)
 {
     if (analogTrigger == null)
         throw new ArgumentNullException(nameof(analogTrigger), "Analog Trigger given was null");
     SetDownSource(analogTrigger.CreateOutput(triggerType));
     m_allocatedDownSource = true;
 }