Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how to route the analog trigger to output in .NET

Hi all
 
I want to digitize an analog sinus signal of 1 Hz and simultaniously generate an digital pulse in syncronasation with the sinus peaks.
 
I'm trying to solve this by routing the analog trigger signal on the input channel to an digital output.
 
I have read all the samples in LabView so please dont direct me to them again.  Can someone help me to configure the DAQmx driver for me?
 
Below you can find my test code but it doesn't work at all. What is wrong?!!

// Create the master and slave tasks

inputTask =

new Task("inputTask");

outputTask =

new Task("outputTask");

// Configure both tasks

inputTask.AIChannels.CreateVoltageChannel("Dev2/ai0", "", AITerminalConfiguration.Differential, -10, 10, AIVoltageUnits.Volts);

outputTask.COChannels.CreatePulseChannelTime("Dev2/ctr0", "", COPulseTimeUnits.Seconds, COPulseIdleState.Low, initialDelay, lowTime, highTime);

// Set up the timing

inputTask.Timing.ConfigureSampleClock("", 1000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 1000);

outputTask.Timing.ConfigureImplicit(SampleQuantityMode.FiniteSamples, 1);

// Set up the triggers

inputTask.Triggers.ReferenceTrigger.ConfigureAnalogEdgeTrigger("APFI0", AnalogEdgeReferenceTriggerSlope.Rising, level, 2);

outputTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("ai/ReferenceTrigger", DigitalEdgeStartTriggerEdge.Rising);

// Verify the tasks

inputTask.Control(TaskAction.Verify);

outputTask.Control(TaskAction.Verify);

0 Kudos
Message 1 of 1
(2,967 Views)