Exemplo n.º 1
0
        internal void CreateMeasurementChannel()
        {
            MAIMeasurementChannelAD nc = Channel.CreateMeasurementChannel(Oversampling, GainF, Bipolar);

            nc.Name = labelChannel.Text;
            nc.Unit = "Volt";
        }
Exemplo n.º 2
0
        private void ConfigAndStartMeas()
        {
            if (checkBoxAD0.Checked)
            {
                MAIMeasurementChannelAD c = m_maiDevice.ADChannels[0].CreateMeasurementChannel(OversamplingMode.Disabled, GainFactor.Disabled, true);
                c.Name = "AD0";
            }
            if (checkBoxAD1.Checked)
            {
                MAIMeasurementChannelAD c = m_maiDevice.ADChannels[1].CreateMeasurementChannel(OversamplingMode.Disabled, GainFactor.Disabled, true);
                c.Name = "AD1";
            }
            if (checkBoxAD2.Checked)
            {
                MAIMeasurementChannelAD c = m_maiDevice.ADChannels[2].CreateMeasurementChannel(OversamplingMode.Disabled, GainFactor.Disabled, true);
                c.Name = "AD2";
            }
            if (checkBoxAD3.Checked)
            {
                MAIMeasurementChannelAD c = m_maiDevice.ADChannels[3].CreateMeasurementChannel(OversamplingMode.Disabled, GainFactor.Disabled, true);
                c.Name = "AD3";
            }

            if (checkBoxCT0.Checked)
            {
                MAIMeasurementChannelCT c = m_maiDevice.CTChannels[0].CreatePeriodCounter(m_ct0SignalEdge, m_ct0Resolution, true);
            }
            if (checkBoxCT1.Checked)
            {
                MAIMeasurementChannelCT c = m_maiDevice.CTChannels[1].CreatePeriodCounter(m_ct1SignalEdge, m_ct1Resolution, true);
            }

            if (!checkBoxLoopBack.Checked)
            {
                if (checkBoxDA0.Checked)
                {
                    if (m_Out0Buffer == null)
                    {
                        m_Out0Buffer = FormChooseOutputWave.CalcuateSinePeriod(Convert.ToDouble(comboBoxOutputRate.Text), (double)m_Out0SineFreq, (double)m_Out0SineAmplitude);
                    }
                    MAIMeasurementChannelDA c = m_maiDevice.DAChannels[0].CreateAutomaticOutputChannel(m_Out0Buffer);
                }
                if (checkBoxDA1.Checked)
                {
                    if (m_Out1Buffer == null)
                    {
                        m_Out1Buffer = FormChooseOutputWave.CalcuateSinePeriod(Convert.ToDouble(comboBoxOutputRate.Text), (double)m_Out1SineFreq, (double)m_Out1SineAmplitude);
                    }
                    MAIMeasurementChannelDA c = m_maiDevice.DAChannels[1].CreateAutomaticOutputChannel(m_Out1Buffer);
                }
            }

            double sr = (double)Convert.ToUInt32(comboBoxSamplerate.Text);

            m_maiDevice.ADChannels.SetSampleRate(sr);
            m_maiDevice.ADChannels.DataSink.Target = m_dsTarget;

            m_maiDevice.ConfigMeasure();

            if (m_maiDevice.DAChannels.MeasurementChannelsCount > 0)
            {
                m_maiDevice.DAChannels.SetMeasurementBufferNotificationLevel(1);
                m_maiDevice.DAChannels.StartNotificationThread();
                m_maiDevice.DAChannels.StartOutput();
            }
            m_maiDevice.ADChannels.DataSink.Enable(DateTime.Now);  // Datasink starten
            SetUpPrevPresets();
            m_maiDevice.StartMeasure();
        }