Exemplo n.º 1
0
        private void buttonConfigDA1_Click(object sender, EventArgs e)
        {
            FormChooseOutputWave fcow = new FormChooseOutputWave();

            fcow.SineFrequency  = (uint)m_Out1SineFreq;
            fcow.SineAmplitude  = (uint)m_Out1SineAmplitude;
            fcow.UseSine        = m_Out1Sinus;
            fcow.TMHeaderfile   = m_Out1TMHeaderfile;
            fcow.TMChannelindex = m_Out1TMChannel;

            fcow.Text = "Output Channel 0 Configuration";
            if (fcow.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            m_Out1SineFreq      = (uint)fcow.SineFrequency;
            m_Out1Sinus         = fcow.UseSine;
            m_Out1TMHeaderfile  = fcow.TMHeaderfile;
            m_Out1SineAmplitude = fcow.SineAmplitude;
            m_Out1TMChannel     = fcow.TMChannelindex;

            m_Out1Buffer = null;
            if (!m_Out1Sinus)
            {
                m_Out1Buffer = fcow.GetOutputDataChannel();
            }
        }
Exemplo n.º 2
0
        private void buttonConfigDA0_Click(object sender, EventArgs e)
        {
            FormChooseOutputWave fcow = new FormChooseOutputWave();

            fcow.SineFrequency = (uint) m_Out0SineFreq;
            fcow.SineAmplitude = (uint)m_Out0SineAmplitude;

            fcow.UseSine = m_Out0Sinus;
            fcow.TMHeaderfile = m_Out0TMHeaderfile;
            fcow.TMChannelindex = m_Out0TMChannel;

            fcow.Text = "Output Channel 0 Configuration";
            if (fcow.ShowDialog() != DialogResult.OK)
                return;

            m_Out0SineFreq =  fcow.SineFrequency ;
            m_Out0Sinus = fcow.UseSine;
            m_Out0TMHeaderfile = fcow.TMHeaderfile ;
            m_Out0Buffer = null;
            m_Out0SineAmplitude =fcow.SineAmplitude;
            m_Out0TMChannel  = fcow.TMChannelindex;

            if (!m_Out0Sinus)
                m_Out0Buffer = fcow.GetOutputDataChannel();
        }
Exemplo n.º 3
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();
        }