Hi i have a question about using the daq and the code to control it
I'm using 1 analog channel AO0 for generation of sinus from 10Hz to 3kHz (10, 30, 50, 100, 500, 750, 1000, 3000)(Hz). This signal enters to electronic circuit, from the circuit i have two outputs, they are connected to AI2 and AI3.
from the examples i took some code
to generate and measure all 3 channels simultaneously, i'm using finite mode for the sampling AI.
code:
// Create the master and slave tasks
inputTask = new Task("inputTask");
outputTask = new Task("outputTask");
// Configure both tasks with the values selected on the UI.
inputTask.AIChannels.CreateVoltageChannel("Dev2\ai2:3, "", AITerminalConfiguration.Rse,
inputMinValue, inputMaxValue, AIVoltageUnits.Volts);
// Configure timing specs
SAMPLERATE = 5000 * 2;
RATE = 5000; //samples per channel /s
inputTask.Timing.ConfigureSampleClock("", SAMPLERATE, SampleClockActiveEdge.Rising,
SampleQuantityMode.FiniteSamples, RATE);
outputTask.AOChannels.CreateVoltageChannel(Generator_AO, "", inputMinValue,
inputMaxValue, AOVoltageUnits.Volts);
// Verify the tasks
inputTask.Control(TaskAction.Verify);
outputTask.Control(TaskAction.Verify);
FunctionGenerator fGen = new FunctionGenerator(outputTask.Timing, FREQ, SamplesBuffer.ToString(),
CyclesBuffer.ToString(), "Sine", Voltage_GenSinus.ToString());
outputTask.Timing.ConfigureSampleClock("", fGen.ResultingSampleClockRate, SampleClockActiveEdge.Rising,
SampleQuantityMode.FiniteSamples, SamplesBuffer);
output = fGen.Data;
writer = new AnalogSingleChannelWriter(outputTask.Stream);
writer.WriteMultiSample(false, output);
// Officially start the task
outputTask.Start();
inputTask.Start();
reader = new AnalogMultiChannelReader(inputTask.Stream);
data = reader.ReadWaveform(output.Length);//reader.ReadWaveform(5000);
dataToDataTable(output, data, ref inputDataTable, group_index);
inputTask.Stop();
outputTask.Stop();
variables RATE = 5000 (samples per channel), SAMPLERATE = RATE * 2
i know that sample rate must be at least multiply 2 of measured frequency. everything works fine
up to 100Hz
at frequency bigger from 100Hz i have ten periods of sinus of results
SampleBuffer for sinus from 10hz to 100hz is 5000 and from 500hz to 3000hz is 1000
why this happen, this is can not be changed at work of the task
the graph of the measurement of high freq is the last one
tech spec for this daq input 500kS/s
output is 900kS/s
why at the first line it not measuring the signal as it must be done like at low freqs?