/// <summary>
        /// Not support by usb-1208
        /// </summary>
        /// <param name="Chan"></param>
        /// <returns></returns>
        public float ReadTemperature(int Chan)
        {
            MccDaq.TempScale MccScale  = MccDaq.TempScale.Celsius;
            float            TempValue = 0.0f;

            MccDaq.ThermocoupleOptions Options = MccDaq.ThermocoupleOptions.WaitForNewData;
            MccDaq.ErrorInfo           ULStat  = DaqBoard.TIn(Chan, MccScale, out TempValue, Options);

            return(TempValue);
        }
Exemplo n.º 2
0
        private void tmrConvert_Tick(object eventSender, System.EventArgs eventArgs)
        {
            bool ValidChan;

            tmrConvert.Stop();

            //  Collect the data with Mccdaq.MccBoard.TIn()

            //  Parameters:
            //    Chan       :the A/D and channel number; starts at 16 if using
            //                an EXP (calculated by (ADChan + 1) * 16 + EXPChan)
            //    MccScale   :the temperature scale (F, C or K)
            //    DataValue  :the name for the value collected
            //    ADChan     :usually channel 0 for CIO-EXP16

            short ADChan = 0; //    If using a device with an EXP attached,

            //                      allows access to 16 channels on the EXP board
            //                      increasing this number allows access to upper
            //                      bank on EXP32 and additional EXP boards

            MccDaq.TempScale MccScale = MccDaq.TempScale.Celsius;
            int Chan = 0;

            ValidChan = int.TryParse(txtExpChan.Text, out Chan);
            if (ValidChan)
            {
                if (UsesEXPs > 0)
                {
                    Chan = Chan + (ADChan + 1) * 16;
                }
            }

            float TempValue = 0.0f;

            MccDaq.ThermocoupleOptions Options = MccDaq.ThermocoupleOptions.Filter;
            MccDaq.ErrorInfo           ULStat  = DaqBoard.TIn(Chan, MccScale, out TempValue, Options);

            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                tmrConvert.Start();
            }

            lblShowData.Text = TempValue.ToString("0") + "°C"; //  print the value
        }
Exemplo n.º 3
0
 protected override void Init()
 {
     m_buffer = new float[1];
     m_channels = new MccDAQChannel[m_channelsNum];
     m_status = MccService.ErrHandling(ErrorReporting.DontPrint, ErrorHandling.DontStop);
     DaqBoard = new MccDaq.MccBoard(m_board);
     m_status = DaqBoard.BoardConfig.GetUsesExps(out UsesEXPs);
     if (m_status.Value == ErrorInfo.ErrorCode.BadBoard)
     {
         throw new ArgumentException(String.Format("MccDAQBoard number {0} failed to init! Check Instacal for valid board numbers.", m_board));
     }
     m_units = MccDaq.TempScale.Celsius;
     m_options = 0;
 }