Exemplo n.º 1
0
        private void cmdSendData_Click(object eventSender, System.EventArgs eventArgs)
        {
            //  Parameters:
            //    LowChan    :the lower channel of the scan
            //    HighChan   :the upper channel of the scan
            //    NumPoints  :the number of D/A values to send
            //    Rate       :per channel sampling rate ((samples per second) per channel)
            //    DAData     :array of values to send to the scanned channels
            //    Options    :data send options

            FirstPoint = 0;
            int Rate = 100;     //  Rate of data update (ignored if board does not

            //                  support timed analog output)
            MccDaq.ScanOptions Options = MccDaq.ScanOptions.Default;  // foreground mode scan

            MccDaq.ErrorInfo ULStat = DaqBoard.AOutScan
                                          (LowChan, HighChan, NumPoints, ref Rate, Range, MemHandle, Options);

            float VoltValue;

            for (int i = 0; i < NumPoints; ++i)
            {
                lblAOutData[i].Text  = DAData[i].ToString("0");
                VoltValue            = ConvertToVolts(DAData[i]);
                lblAOutVolts[i].Text = VoltValue.ToString("0.000V");
            }

            for (int i = HighChan + 1; i <= 3; i++)
            {
                lblAOutData[i].Text = "";
            }
        }
Exemplo n.º 2
0
 private void optDefault_CheckedChanged(object eventSender, System.EventArgs eventArgs)         /* Handles optDefault.CheckedChanged */
 {
     if (optDefault.Checked)
     {
         Options = MccDaq.ScanOptions.ConvertData;
     }
 }
Exemplo n.º 3
0
        private int MemHandle   = 0;                     // define a variable to contain the handle for
        // memory allocated by Windows through MccDaq.MccServices.WinBufAlloc()


        public frmDataDisplay()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            //  Initiate error handling
            //   activating error handling will trap errors like
            //   bad channel numbers and non-configured conditions.
            //   Parameters:
            //     MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed
            //     MccDaq.ErrorHandling.StopAll   :if an error is encountered, the program will stop

            MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll);


            // Create a new MccBoard object for Board 0
            DaqBoard = new MccDaq.MccBoard(0);

            //  set aside memory to hold data
            MemHandle = MccDaq.MccService.WinBufAlloc(NumPoints);


            Options = MccDaq.ScanOptions.ConvertData;

            lblADData = (new Label[] { _lblADData_0, _lblADData_1, _lblADData_2, _lblADData_3,
                                       _lblADData_4, _lblADData_5, _lblADData_6, _lblADData_7 });
        }
Exemplo n.º 4
0
        private void tmrConvert_Tick(object eventSender, System.EventArgs eventArgs)         /* Handles tmrConvert.Tick */
        {
            tmrConvert.Stop();

            //  Collect the values by calling MccDaq.MccBoard.AInScan function
            //  Parameters:
            //    LowChan    :the first channel of the scan
            //    HighChan   :the last channel of the scan
            //    Count      :the total number of A/D samples to collect
            //    Rate       :sample rate
            //    Range      :the range for the board
            //    MemHandle  :Handle for Windows buffer to store data in
            //    Options    :data collection options
            int LowChan = 0;                        //  first channel to acquire

            HighChan = int.Parse(txtHighChan.Text); //  last channel to acquire
            if (HighChan > 7)
            {
                HighChan = 7;
            }
            txtHighChan.Text = HighChan.ToString();

            int Count = NumPoints;                               //  total number of data points to collect
            int Rate  = 100;                                     //  sampling rate is ignored

            MccDaq.Range       Range   = MccDaq.Range.Bip5Volts; // set the range
            MccDaq.ScanOptions Options = MccDaq.ScanOptions.ConvertData
                                         | MccDaq.ScanOptions.ExtClock;
            MccDaq.ErrorInfo ULStat = DaqBoard.AInScan(LowChan, HighChan, Count, ref Rate, Range, MemHandle, Options);


            //  Transfer the data from the memory buffer set up by Windows to an array

            if (HighResAD)
            {
                ULStat = MccDaq.MccService.WinBufToArray32(MemHandle, ADData32, FirstPoint, Count);

                for (int i = 0; i <= HighChan; ++i)
                {
                    lblADData[i].Text = ADData32[i].ToString("0");
                }
            }
            else
            {
                ULStat = MccDaq.MccService.WinBufToArray(MemHandle, ADData, FirstPoint, Count);

                for (int i = 0; i <= HighChan; ++i)
                {
                    lblADData[i].Text = ADData[i].ToString("0");
                }
            }

            for (int j = HighChan + 1; j <= 7; ++j)
            {
                lblADData[j].Text = ("");
            }

            tmrConvert.Start();
        }
Exemplo n.º 5
0
 private void optModeSing_CheckedChanged(object eventSender, System.EventArgs eventArgs)         /* Handles optModeSing.CheckedChanged */
 {
     if (optModeSing.Checked)
     {
         Options = MccDaq.ScanOptions.ConvertData
                   | MccDaq.ScanOptions.SingleIo;
     }
 }
Exemplo n.º 6
0
        public Form1()
        {
            oThread = new Thread(new ThreadStart(CountMeas));
            InitializeComponent();

            chart1.ChartAreas[0].AxisY.Maximum = 3;
            chart1.ChartAreas[0].AxisY.Minimum = 2;
            ADData = new ushort[NumPoints];
            MemHandle = MccDaq.MccService.WinBufAllocEx(NumPoints);
            //Options = MccDaq.ScanOptions.ConvertData;
            Options = MccDaq.ScanOptions.BurstIo;
        }
Exemplo n.º 7
0
        public double[] ReadDyno()
        {
            //establish all the varables for the data
            double[] reading = new double[7];
            double   XForce, YForce, ZForceDyno, TForce, VAngle, XYForce, XYForceAverage;

            //sampleing from all 8 channels, DAQ has a max sampling rate of 10,000Hz so for sampleing 8 channels the rate=10,000/8=1,250
            int LowChan = 0, HighChan = 7, Rate = 1250, Count = 8;//JNEW

            //IntPtr MemHandle = IntPtr.Zero;//JNEW //dont think this is needed here
            int NumPoints  = 8;                                                  //  Number of data points to collect //JNEW
            int FirstPoint = 0;                                                  //  set first element in buffer to transfer to array //JNEW

            short[] ADData = new short[NumPoints];                               //JNEW

            IntPtr MemHandle = MccDaq.MccService.ScaledWinBufAllocEx(NumPoints); //JNEW

            //  return scaled data (dont know exactly what this means)
            Options = MccDaq.ScanOptions.ConvertData | MccDaq.ScanOptions.SingleIo;

            //Options = MccDaq.ScanOptions.ScaleData;
            //Range = MccDaq.Range.Bip5Volts; // set the range
            //Range = MccDaq.Range.Bip10Volts; // set the range

            ULStat = DaqBoard.AInScan(LowChan, HighChan, Count, ref Rate, Range, MemHandle, Options);

            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.BadRange)
            {
                Console.WriteLine("Change the Range argument to one supported by this board.");
            }
            //  Transfer the data from the memory buffer set up by Windows to an array
            ULStat = MccDaq.MccService.WinBufToArray(MemHandle, ADData, FirstPoint, Count);

            //calibration variables (probably from kistler)
            //Copy into local variables
            XForce         = 487.33 * Count2Volt(ADData[0]);
            YForce         = 479.85 * Count2Volt(ADData[1]);
            ZForceDyno     = 2032.52 * Count2Volt(ADData[2]);
            TForce         = 18.91 * Count2Volt(ADData[3]);
            VAngle         = Count2Volt(ADData[7]);
            XYForce        = Math.Sqrt(XForce * XForce + YForce * YForce);
            XYForceAverage = averager.calculateAverage(XYForce);

            reading[0] = XForce;
            reading[1] = YForce;
            reading[2] = ZForceDyno;
            reading[3] = TForce;
            reading[4] = VAngle;
            reading[5] = XYForce;
            reading[6] = XYForceAverage;

            return(reading);
        }
Exemplo n.º 8
0
        //constuctor for the dyno
        public Dyno()
        {
            isDynCon = false;

            //Initialize Error Handling
            ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll);

            //Create an object for board 0
            DaqBoard = new MccDaq.MccBoard(0);

            //Set the range
            Range = MccDaq.Range.Bip10Volts;
            //  return scaled data
            Options = MccDaq.ScanOptions.ScaleData;

            // creating and defining the objects for the moving average
            filterLength = 5;
            averager     = new MovingAverage(filterLength);

            XForce         = 0;
            YForce         = 0;
            ZForceDyno     = 0;
            TForce         = 0;
            VAngle         = 0;
            XYForce        = 0;
            XYForceAverage = 0;

            // Try to initialize the dyno control port and catch any errors
            try
            {
                //Set up port for controlling the dyno
                DynoControlPort          = new SerialPort();
                DynoControlPort.PortName = "COM3";
                DynoControlPort.BaudRate = 4800;
                DynoControlPort.Parity   = Parity.None;
                DynoControlPort.StopBits = StopBits.One;
                DynoControlPort.DataBits = 8;
                DynoControlPort.Open();
            }
            catch (System.IO.IOException e)
            {
                //MessageBox.Show("Open device manager in windows and the 'Setup Serial Ports' section of the C# code and check the serial port names and settings are correct\n\n" + e.ToString(), "Serial Port Error");
                //Process.GetCurrentProcess().Kill();
            }
            catch (System.UnauthorizedAccessException e)
            {
                //MessageBox.Show("Something is wrong? maybe try to restart computer?\n\nHere is some error message stuff...\n\n" + e.ToString(), "Serial Port Error");
                //Process.GetCurrentProcess().Kill();
            }
        }
Exemplo n.º 9
0
        private IntPtr MemHandle = IntPtr.Zero;            // define a variable to contain the handle for
        // memory allocated by Windows through MccDaq.MccServices.WinBufAlloc()


        public frmDataDisplay()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            //  Initiate error handling
            //   activating error handling will trap errors like
            //   bad channel numbers and non-configured conditions.
            //   Parameters:
            //     MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed
            //     MccDaq.ErrorHandling.StopAll   :if an error is encountered, the program will stop

            MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll);


            // Create a new MccBoard object for Board 0
            DaqBoard = new MccDaq.MccBoard(0);

            // Get the resolution of A/D
            int ADRes;

            DaqBoard.BoardConfig.GetAdResolution(out ADRes);

            // check If the resolution of A/D is higher than 16 bit.
            // If it is, then the A/D is high resolution.
            if (ADRes > 16)
            {
                HighResAD = true;
            }

            //  set aside memory to hold data
            if (HighResAD)
            {
                MemHandle = MccDaq.MccService.WinBufAlloc32Ex(NumPoints);
            }
            else
            {
                MemHandle = MccDaq.MccService.WinBufAllocEx(NumPoints);
            }



            Options = MccDaq.ScanOptions.ConvertData;

            lblADData = (new Label[] { _lblADData_0, _lblADData_1, _lblADData_2, _lblADData_3,
                                       _lblADData_4, _lblADData_5, _lblADData_6, _lblADData_7 });
        }
Exemplo n.º 10
0
        private void cmdReadDIn_Click(object eventSender, System.EventArgs eventArgs)         /* Handles cmdReadDIn.Click */
        {
            // read the digital input and display
            //   Parameters:
            //      PortNum      :the input port
            //      Count        :number of times to read digital input
            //      Rate         :sample rate in samples/second
            //      DataBuffer() :the array for the digital input values read from the port
            //      Options      :data collection options
            Count = NumPoints;
            int Rate = 100;

            MccDaq.ScanOptions Options = MccDaq.ScanOptions.WordXfer
                                         | MccDaq.ScanOptions.Background;
            MccDaq.ErrorInfo ULStat = DaqBoard.DInScan(PortNum, Count, ref Rate, MemHandle, Options);


            tmrCheckStatus.Enabled = true;
        }
Exemplo n.º 11
0
        private void cmdSendData_Click(object eventSender, System.EventArgs eventArgs)         /* Handles cmdSendData.Click */
        {
            //  Parameters:
            //    LowChan    :the lower channel of the scan
            //    HighChan   :the upper channel of the scan
            //    Count      :the number of D/A values to send
            //    Rate       :per channel sampling rate ((samples per second) per channel)
            //    DAData     :array of values to send to the scanned channels
            //    Options    :data send options
            FirstPoint = 0;
            int LowChan  = 0;                                        // First analog output channel
            int HighChan = 1;                                        // Last analog output channel
            int Rate     = 100;                                      // Rate of data update (ignored if board does not support timed analog output)

            MccDaq.Range       Gain    = MccDaq.Range.Bip5Volts;     // Ignored if gain is not programmable
            MccDaq.ScanOptions Options = MccDaq.ScanOptions.Default; // foreground mode scan
            MccDaq.ErrorInfo   ULStat  = DaqBoard.AOutScan(LowChan, HighChan, Count, ref Rate, Gain, MemHandle, Options);

            for (int i = 0; i <= NumPoints - 1; ++i)
            {
                lblAOutData[i].Text = DAData[i].ToString("0");
            }
        }
Exemplo n.º 12
0
 /* Handles optDefault.CheckedChanged */
 private void optDefault_CheckedChanged(object eventSender, System.EventArgs eventArgs)
 {
     if (optDefault.Checked)
         Options = MccDaq.ScanOptions.ConvertData;
 }
Exemplo n.º 13
0
 /* Handles optModeSing.CheckedChanged */
 private void optModeSing_CheckedChanged(object eventSender, System.EventArgs eventArgs)
 {
     if (optModeSing.Checked)
         Options = MccDaq.ScanOptions.ConvertData
                 | MccDaq.ScanOptions.SingleIo;
 }
Exemplo n.º 14
0
        private void cmdStart_Click(object eventSender, System.EventArgs eventArgs)         /* Handles cmdStart.Click */
        {
            cmdStart.Enabled = false;

            //  Select the trigger source using Mccdaq.MccBoard.SetTrigger()
            //  Parameters:
            //    TrigType       :the type of triggering based on external trigger source
            //    LowThreshold   :Low threshold when the trigger input is analog
            //    HighThreshold  :High threshold when the trigger input is analog
            float highVal = 1.0F;

            MccDaq.Range Range         = MccDaq.Range.Bip10Volts;     // analog trigger range
            ushort       HighThreshold = 0;

            MccDaq.ErrorInfo ULStat = DaqBoard.FromEngUnits(Range, highVal, out HighThreshold);

            float  lowVal       = 0.1F;
            ushort LowThreshold = 0;

            ULStat = DaqBoard.FromEngUnits(Range, lowVal, out LowThreshold);

            MccDaq.TriggerType TrigType = MccDaq.TriggerType.TrigAbove;
            ULStat = DaqBoard.SetTrigger(TrigType, LowThreshold, HighThreshold);

            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                //  Collect the values with MccDaq.MccBoard.AInScan()
                //  Parameters:
                //    LowChan    :the first channel of the scan
                //    HighChan   :the last channel of the scan
                //    Count      :the total number of A/D samples to collect
                //    Rate       :sample rate
                //    Range      :the range for the board
                //    MemHandle  :Handle for Windows buffer to store data in
                //    Options    :data collection options
                int LowChan = 0;                        //  first channel to acquire
                HighChan = int.Parse(txtHighChan.Text); //  last channel to acquire
                if (HighChan > 7)
                {
                    HighChan = 7;
                }
                txtHighChan.Text = HighChan.ToString();

                int Count = NumPoints;                                      //  total number of data points to collect
                int Rate  = 390;                                            //  per channel sampling rate ((samples per second) per channel)
                Range = MccDaq.Range.Bip5Volts;                             // set the range
                MccDaq.ScanOptions Options = MccDaq.ScanOptions.ConvertData //  return data as 12-bit values
                                             | MccDaq.ScanOptions.ExtTrigger;
                ULStat = DaqBoard.AInScan(LowChan, HighChan, Count, ref Rate, Range, MemHandle, Options);

                if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.BadRange)
                {
                    MessageBox.Show("Change the Range argument to one supported by this board.", "Unsupported Range", 0);
                }


                //  Transfer the data from the memory buffer set up by Windows to an array
                ULStat = MccDaq.MccService.WinBufToArray(MemHandle, out ADData[0], FirstPoint, Count);


                for (int i = 0; i <= HighChan; ++i)
                {
                    lblADData[i].Text = ADData[i].ToString("0");
                }

                for (int j = HighChan + 1; j <= 7; ++j)
                {
                    lblADData[j].Text = "";
                }
            }
            cmdStart.Enabled = true;
        }
Exemplo n.º 15
0
        private MccDaq.ScanOptions Options; //  define AInScan Options as Module level variable

        #endregion Fields

        #region Constructors

        // memory allocated by Windows through MccDaq.MccServices.WinBufAlloc()
        public frmDataDisplay()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            //  Initiate error handling
            //   activating error handling will trap errors like
            //   bad channel numbers and non-configured conditions.
            //   Parameters:
            //     MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed
            //     MccDaq.ErrorHandling.StopAll   :if an error is encountered, the program will stop

            MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll);

            // Create a new MccBoard object for Board 0
            DaqBoard = new MccDaq.MccBoard(0);

            //  set aside memory to hold data
            MemHandle = MccDaq.MccService.WinBufAlloc(NumPoints);

            Options = MccDaq.ScanOptions.ConvertData;

            lblADData = (new Label[]{_lblADData_0, _lblADData_1, _lblADData_2, _lblADData_3,
                                    _lblADData_4, _lblADData_5, _lblADData_6, _lblADData_7});
        }
Exemplo n.º 16
0
        private void cmdStartAcq_Click(object eventSender, System.EventArgs eventArgs)
        {
            cmdStartAcq.Enabled    = false;
            cmdStartAcq.Visible    = false;
            cmdStopConvert.Enabled = true;
            cmdStopConvert.Visible = true;

            //  Parameters:
            //    LowChan    :first A/D channel of the scan
            //    HighChan   :last A/D channel of the scan
            //    Count      :the total number of A/D samples to collect
            //    Rate       :per channel sampling rate ((samples per second) per channel)
            //    Range      :the gain for the board
            //    FileName   :the filename for the collected data values
            //    Options    :data collection options
            int    Count    = NumPoints;
            string FileName = txtFileName.Text; //  a full path may be required here
            int    Rate     = 1000;
            int    LowChan  = 0;
            int    HighChan = 1;

            MccDaq.ScanOptions Options = MccDaq.ScanOptions.Default;

            string DataCount = NumPoints.ToString("0");

            lblAcqStat.Text     = "Collecting " + DataCount + " data points";
            lblShowRate.Text    = Rate.ToString("0");
            lblShowLoChan.Text  = LowChan.ToString("0");
            lblShowHiChan.Text  = HighChan.ToString("0");
            lblShowOptions.Text = Enum.Format(Options.GetType(), Options, "d");
            lblShowGain.Text    = Range.ToString();
            lblShowFile.Text    = FileName;
            lblShowCount.Text   = Count.ToString("0");
            lblShowPreTrig.Text = "Not Applicable";
            Application.DoEvents();

            //  Collect the values with Collect the values by calling MccDaq.MccBoard.FileAInScan()

            MccDaq.ErrorInfo ULStat = DaqBoard.FileAInScan
                                          (LowChan, HighChan, Count, ref Rate, Range, FileName, Options);

            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.BadFileName)
            {
                MessageBox.Show(
                    "Enter the name of the file to create in text box.",
                    "Bad File Name", 0);
                cmdStopConvert.Enabled = false;
                cmdStopConvert.Visible = false;
                cmdStartAcq.Enabled    = true;
                cmdStartAcq.Visible    = true;
                txtFileName.Focus();
                return;
            }


            //  show how many data points were collected
            short FileLowChan;
            short FileHighChan;
            int   TotalCount;
            int   PretrigCount;

            ULStat = MccDaq.MccService.FileGetInfo
                         (FileName, out FileLowChan, out FileHighChan,
                         out PretrigCount, out TotalCount, out Rate, out Range);

            lblReadRate.Text    = Rate.ToString("0");
            lblReadLoChan.Text  = FileLowChan.ToString("0");
            lblReadHiChan.Text  = FileHighChan.ToString("0");
            lblReadOptions.Text = Enum.Format(Options.GetType(), Options, "d");
            lblReadGain.Text    = Range.ToString();
            lblReadFile.Text    = FileName;

            lblReadTotal.Text   = TotalCount.ToString("0");
            lblReadPreTrig.Text = PretrigCount.ToString("0");
        }
Exemplo n.º 17
0
        private void cmdStart_Click(object eventSender, System.EventArgs eventArgs)
        {
            string TrigSource;

            MccDaq.ErrorInfo   ULStat;
            MccDaq.TriggerType TrigType;
            float LSB, VoltageRange;
            int   FSCounts, Rate;
            bool  ValidChan;

            cmdStart.Enabled = false;

            //  Select the trigger source using Mccdaq.MccBoard.SetTrigger()
            //  Parameters:
            //    TrigType       :the type of triggering based on external trigger source
            //    LowThreshold   :Low threshold when the trigger input is analog
            //    HighThreshold  :High threshold when the trigger input is analog

            float highVal = 1.53F;
            float lowVal  = 0.1F;

            TrigType = MccDaq.TriggerType.TrigAbove;

            TrigSource = "analog trigger input";
            ushort HighThreshold = 0;
            ushort LowThreshold  = 0;

            if (AIOProps.ATrigRes == 0)
            {
                ULStat = DaqBoard.FromEngUnits(Range, highVal, out HighThreshold);
                ULStat = DaqBoard.FromEngUnits(Range, lowVal, out LowThreshold);
            }
            else
            {
                //Use the value acquired from the AnalogIO module, since the resolution
                //of the input is different from the resolution of the trigger.
                //Calculate trigger based on resolution returned and trigger range.
                VoltageRange = AIOProps.ATrigRange;
                if (AIOProps.ATrigRange == -1)
                {
                    VoltageRange = AIOProps.GetRangeVolts(Range);
                    TrigSource   = "first channel in scan";
                }
                FSCounts      = (int)Math.Pow(2, AIOProps.ATrigRes);
                LSB           = VoltageRange / FSCounts;
                LowThreshold  = (ushort)((lowVal / LSB) + (FSCounts / 2));
                HighThreshold = (ushort)((highVal / LSB) + (FSCounts / 2));
            }

            lblInstruction.Text = "Board " + DaqBoard.BoardNum.ToString() +
                                  " collecting analog data on up to " + NumAIChans.ToString() +
                                  " channels using AInScan with Range set to " + Range.ToString() + ".";

            lblResult.Text = "Waiting for a trigger at " + TrigSource + ". " +
                             "Trigger criterea: signal rising above " + highVal.ToString("0.00") +
                             "V. (Ctl-Break to abort.)";
            Application.DoEvents();

            ULStat = DaqBoard.SetTrigger(TrigType, LowThreshold, HighThreshold);

            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                //  Collect the values with MccDaq.MccBoard.AInScan()
                //  Parameters:
                //    LowChan    :the first channel of the scan
                //    HighChan   :the last channel of the scan
                //    Count      :the total number of A/D samples to collect
                //    Rate       :sample rate
                //    Range      :the range for the board
                //    MemHandle  :Handle for Windows buffer to store data in
                //    Options    :data collection options

                ValidChan = int.TryParse(txtHighChan.Text, out HighChan);
                if (ValidChan)
                {
                    if ((HighChan > MaxChan))
                    {
                        HighChan = MaxChan;
                    }
                    txtHighChan.Text = HighChan.ToString();
                }

                int Count = NumPoints; //  total number of data points to collect
                // per channel sampling rate ((samples per second) per channel)
                Rate = 1000 / ((HighChan - LowChan) + 1);
                MccDaq.ScanOptions Options = MccDaq.ScanOptions.ConvertData  //  return data as 12-bit values
                                             | MccDaq.ScanOptions.ExtTrigger;

                ULStat         = DaqBoard.AInScan(LowChan, HighChan, Count, ref Rate, Range, MemHandle, Options);
                lblResult.Text = "";

                if (ULStat.Value == ErrorInfo.ErrorCode.Interrupted)
                {
                    lblInstruction.Text = "Scan interrupted while waiting " +
                                          "for trigger on board " + DaqBoard.BoardNum.ToString() +
                                          ". Click Start to try again.";
                    cmdStart.Enabled = true;
                    return;
                }
                else if (!(ULStat.Value == ErrorInfo.ErrorCode.NoErrors))
                {
                    lblInstruction.Text = "Error occurred on board " +
                                          DaqBoard.BoardNum.ToString() +
                                          ": " + ULStat.Message;
                    cmdStart.Enabled = false;
                    return;
                }

                //  Transfer the data from the memory buffer set up by Windows to an array
                if (ADResolution > 16)
                {
                    ULStat = MccDaq.MccService.WinBufToArray32(MemHandle, ADData32, FirstPoint, Count);

                    for (int i = 0; i <= HighChan; ++i)
                    {
                        lblADData[i].Text = ADData32[i].ToString("0");
                    }
                }
                else
                {
                    ULStat = MccDaq.MccService.WinBufToArray(MemHandle, ADData, FirstPoint, Count);

                    for (int i = 0; i <= HighChan; ++i)
                    {
                        lblADData[i].Text = ADData[i].ToString("0");
                    }
                }

                for (int j = HighChan + 1; j <= 7; ++j)
                {
                    lblADData[j].Text = "";
                }
            }
            cmdStart.Enabled = true;
        }