示例#1
0
        private void tmrStartConvert_Tick(object eventSender, System.EventArgs eventArgs) /* Handles tmrStartConvert.Tick */
        {
            ushort DataValue;
            int    Chan      = int.Parse(txtShowChannel.Text);
            float  EngUnits  = float.Parse(txtShowTrigSet.Text);
            ushort TrigValue = GetTrigCounts(Range, EngUnits);

            MccDaq.TriggerType TrigType;
            if (chkNegTrigger.Checked == true)
            {
                TrigType = MccDaq.TriggerType.TrigBelow;
            }
            else
            {
                TrigType = MccDaq.TriggerType.TrigAbove;
            }

            tmrStartConvert.Stop();

            //  Monitor the channel with MccDaq.MccBoard.ATrig
            //   The input value that meets the threshold will become DataValue
            //   The data value will be updated and displayed until a Stop event occurs.
            //   Parameters:
            //     Chan       :the input channel number
            //     TrigType   :specifies whether the trigger is to be above
            //                 or below TrigValue
            //     TrigValue  :the threshold value that will cause the trigger
            //     Range      :the range for the board
            //     DataValue  :the input value read from Chan
            MccDaq.ErrorInfo ULStat = DaqBoard.ATrig(Chan, TrigType, TrigValue, Range, out DataValue);


            //  print the value that meets the threshold
            lblTrigStatus.Text    = "The value that caused the last trigger was:";
            lblShowTrigValue.Text = DataValue.ToString("D");

            ULStat            = DaqBoard.ToEngUnits(Range, DataValue, out EngUnits);
            lblShowVolts.Text = EngUnits.ToString("0.00###") + "V";

            tmrStartConvert.Start();
        }