コード例 #1
0
        /// <summary>
        /// Start a constant output by the DAQ device. This function starts a task named "OutputTask",
        /// Don't forget to stop it when it's no longer needed.
        /// </summary>
        /// <param name="voltage">the requested voltage to apply</param>
        public void StartConstantOutputTask(double voltage)
        {
            int samplesPerChannel = 2500;
            int sampleRate = 2500;

            //
            // generate output array 
            //
            m_functionGenerator = new FunctionGenerator(samplesPerChannel, voltage, voltage);
            
            //
            // get the properties required for the output task
            //
            ContinuousAOTaskProperties outputProperties = new ContinuousAOTaskProperties(null, sampleRate, samplesPerChannel, voltage);
            
            //
            // create the output task
            //
            m_outputTask = m_daqController.CreateContinuousAOTask(outputProperties);

            //
            // create the writer of the output task
            //
            writer = new AnalogSingleChannelWriter(m_outputTask.Stream);

            //
            // write static voltage
            //
            writer.WriteMultiSample(true, m_functionGenerator.ConstWave);
        }
コード例 #2
0
        /// <summary>
        /// Initiate the output task writer, and apply an initial constant bias
        /// </summary>
        /// <param name="task">The output task that the writer will belong to</param>
        /// <param name="settings">The UI settings</param>
        private void InitiateOutputWriter(Task task, IVSettings settings)
        {
            //
            // generate output arrays
            //
            m_functionGenerator = new FunctionGenerator(settings.IVGeneralSettings.SamplesPerCycle,
                                                        settings.IVGeneralSettings.VoltageAmplitude,
                                                        settings.IVGeneralSettings.VoltageAmplitude);

            //
            // create the writer of the output task
            //
            writer = new AnalogSingleChannelWriter(m_outputTask.Stream);

            //
            // write static voltage
            //
            writer.WriteMultiSample(true, m_functionGenerator.ConstWave);
        }