示例#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 = "";
            }
        }
示例#2
0
文件: ULAO02.cs 项目: r4forth/sdkpub
        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");
            }
        }