08-29-2017 02:15 PM
Hello,
I would like to use a start trigger to generate single pulse on my device using it's counter. The following code snippet generates the pulse I want when I comment out all trigger related code. But when it is not commented out and I apply a high signal to the PFI8 terminal, the pulse is not generated. What am I missing?
_counter0Task = new Task(); _counter0Task.COChannels.CreatePulseChannelTicks("Dev1/ctr0", "ctr0", "/Dev1/20MHzTimebase", COPulseIdleState.Low, 0, 100000, 400000); // 100000 = 5ms worth of time. _counter0Task.COChannels[0].CounterTimebaseActiveEdge = COCounterTimebaseActiveEdge.Rising; _counter0Task.Triggers.StartTrigger.Type = StartTriggerType.DigitalEdge; _counter0Task.Triggers.StartTrigger.DigitalEdge.Edge = DigitalEdgeStartTriggerEdge.Rising; _counter0Task.Triggers.StartTrigger.DigitalEdge.Source = "/Dev1/PFI8"; _counter0Task.Control(TaskAction.Verify); CounterSingleChannelWriter counter0MultiChannelWriter = new CounterSingleChannelWriter(_counter0Task.Stream); _counter0Task.Start();
Solved! Go to Solution.
08-29-2017 02:16 PM
I should mention that the device I am using is a NI USB-6218.
08-29-2017 06:23 PM - edited 08-29-2017 06:35 PM
I fixed my issue by applying a continuous 1Hz 50% duty cycle 5V square wave to PFI8. I was originally taking the wire attached to the PFI8 terminal and plugging the other end into the breadboards 5V rail manually.