Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to route a start trigger to a counter?

Solved!
Go to solution

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();
0 Kudos
Message 1 of 3
(2,723 Views)

I should mention that the device I am using is a NI USB-6218.

0 Kudos
Message 2 of 3
(2,721 Views)
Solution
Accepted by topic author b!tmaster

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.

0 Kudos
Message 3 of 3
(2,700 Views)