コード例 #1
0
        private void cmdStartBgnd_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            int   CurIndex;
            int   CurCount;
            short Status;

            MccDaq.ErrorInfo ULStat;
            int Rate;

            MccDaq.ScanOptions Options;
            int Count;
            int PretrigCount;

            cmdStartBgnd.Enabled   = false;
            cmdStartBgnd.Visible   = false;
            cmdStopConvert.Enabled = true;
            cmdStopConvert.Visible = true;
            cmdQuit.Enabled        = false;
            UserTerm = 0;             // initialize user terminate flag

            // Collect the values with cbDaqInScan()
            //  Parameters:
            //    BoardNum        :the number used by CB.CFG to describe this board
            //    ChanArray[]     :array of channel values
            //    ChanTypeArray[] : array of channel types
            //    GainArray[]     :array of gain values
            //    ChansCount        :the number of elements in the arrays (0=disable queue)
            //    PretrigCount    :number of pre-trigger A/D samples to collect
            //    Count         :the total number of A/D samples to collect
            //    Rate          :sample rate in samples per second
            //    ADData[]        :the array for the collected data values
            //    Options          :data collection options

            PretrigCount = 0;
            Count        = NumElements;      // Number of data points to collect
            Options      = MccDaq.ScanOptions.ConvertData | MccDaq.ScanOptions.Background
                           | MccDaq.ScanOptions.Continuous;
            Rate = 100;             // Acquire data at 100 Hz

            ULStat = DaqBoard.DaqInScan(ChanArray, ChanTypeArray, GainArray, ChanCount,
                                        ref Rate, ref PretrigCount, ref Count, MemHandle, Options);

            ULStat = DaqBoard.GetStatus(out Status, out CurCount, out CurIndex,
                                        MccDaq.FunctionType.DaqiFunction);

            if (Status == MccDaq.MccBoard.Running)
            {
                lblShowStat.Text  = "Running";
                lblShowCount.Text = CurCount.ToString("D");
                lblShowIndex.Text = CurIndex.ToString("D");
            }

            tmrCheckStatus.Enabled = true;
        }