Here is the requirement:
2 Analog outputs have to be performed on DAC0 and DAC1 on the occurence of a digital trigger.
At the same digital trigger, the above DAC 0 output has to be sampled(pretrigger and postrigger acquisition has to be performed).
Analog output uses a start trigger and Analog input uses a reference trigger.
How do I make sure that analog output occurs before analog input is performed as both of them occur at the same digital trigger?
Here is a sample code am working on (C#):
DAC0 output is connected to Analog input channel 0 for sampling the DAC 0 ouput.
void someFunction()
{
.....
...
aoTask.AOChannels.CreateVoltageChannel ("Dev1/ao0" ,"StimulusPulse" , -5 ,5 ,AOVoltageUnits.Volts );
aoTask.AOChannels.CreateVoltageChannel ("Dev1/ao1" ,"DCVoltage" , 0 ,5 ,AOVoltageUnits.Volts );
aoTask.Timing.ConfigureSampleClock("",1000 ,SampleClockActiveEdge.Rising ,SampleQuantityMode.FiniteSamples,150 );
aoTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger( "/Dev1/PFI0",DigitalEdgeStartTriggerEdge.Rising);
aoTask.Control (TaskAction.Verify );
aoMultiChannelWriter = new AnalogMultiChannelWriter (aoTask.Stream );
aiTask.AIChannels.CreateVoltageChannel ( "Dev1/ai0","DAC0Output" ,AITerminalConfiguration.Nrse,-5 ,5 ,AIVoltageUnits.Volts ) ;
aiTask.Timing.ConfigureSampleClock("",10000,SampleClockActiveEdge.Rising ,SampleQuantityMode.FiniteSamples,1500);
aiTask.Triggers.ReferenceTrigger.ConfigureDigitalEdgeTrigger( "/Dev1/PFI0",DigitalEdgeReferenceTriggerEdge.Rising,500);
aiTask.Control (TaskAction.Verify );
aiMultiChannelReader = new AnalogMultiChannelReader(aiTask.Stream );
...
...
//aoData contains DAC0 and DAC1 data
aoMultiChannelWriter.WriteMultiSample(false,aoData );
aoTask.Start();
delegateCallBack = new AsyncCallback (AITaskCallBackFunction);
aiMultiChannelReader.BeginReadMultiSample(1500,delegateCallBack,null );
aoTask.WaitUntilDone (-1);
}
void AITaskCallBackFunction(IAsyncResult ar)
{
aiData = aiMultiChannelReader.EndReadMultiSample(ar);
... code to display data
}
Thank you in advance,
Rajesh