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

            /* configure setpoints with cbDaqSetSetpoints()
             *    Parameters:
             *            BoardNum				:the number used by CB.CFG to describe this board
             *            LimitAArray[]			:array of LimitA values
             *            LimitBArray[]			:array of LimitB values
             *            SetpointFlagsArray[]	:array of Setpoint flags
             *            SetpointOutputArray[]   :array of output channels
             *            Output1Array[]			:array of output1 values
             *            Output2Array[]			:array of output2 values
             *            OutputMask1Array[]		:array of output masks for output1
             *            OutputMask2Array[]      :array of output masks for output2
             *            SetpointCount           :Number of setpoints  */

            ULStat = DaqBoard.DaqSetSetpoints(LimitAArray, LimitBArray, Reserved, SetpointFlagsArray, SetpointOutputArray,
                                              Output1Array, Output2Array, OutputMask1Array, OutputMask2Array, SetpointCount);


            MccDaq.DigitalPortDirection Direction;
            MccDaq.DigitalPortType      PortNum;

            //configure FirstPortA for digital input
            PortNum   = (MccDaq.DigitalPortType)ChanArray[2];
            Direction = MccDaq.DigitalPortDirection.DigitalIn;
            ULStat    = DaqBoard.DConfigPort(PortNum, Direction);

            // 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
            //    ChanCount       :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;
        }