Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

trigger N times

Solved!
Go to solution

I am using a 6363. I would like to trigger off an incoming synchronization pulse exactly N times. These pulses are coming in the ~dozen kHz range.

 

My first idea was to make a count ticks CO task on the same pulses and hook it up a pause trigger, but pause triggers only apply to continuous acquisiton.

 

My next idea was to hook up the count ticks CO task as an arm trigger set to 'Good to go if it's high' and not 'arm on rising edge', but it seems that's not in the cards either.

 

Another idea was to use the incoming sync pulses as a sample clock on a binary waveform of 10101010101 (N repeats) and use that as the trigger set instead. But it appears the binary waveform can't be made to advance to its next value on either a rising or a falling edge, so that would trigger every other pulse.

 

Do I need to use a transistor outside the board to do this (with the count ticks CO)? That would definitely do it, but it seems kludgy.

 

SO... Are there nifty efficient ways of doing this? Failing that, is there a way to get the binary waveform to advance on both rising or falling edges?

0 Kudos
Message 1 of 13
(6,847 Views)

Hi LukeASomers,

 

I have take a look at the NI community and found the following example that generates a trigger after counting excactly N pulses, I hope you may find it helpful

 

https://decibel.ni.com/content/docs/DOC-7372

Regards,

Sil.VI
0 Kudos
Message 2 of 13
(6,820 Views)

 It sounds like the original poster wants to generate a pulse for each input trigger received up to N pulses (not generate a single pulse after N input triggers are received).

 

My first idea as well would have been to use a retriggerable single pulse generaiton with a pause trigger, but this isn't supported unfortunately.  With that in mind, I think there are a couple of other possible solutions...

 

With Counters:

You'll have to use two counters, but I think this should work:

 

counter A configured as a retriggerable finite pulse generation.

 

counter B configured as a finite counter output (number of samples= N) with a combined high/low time equal to the number of pulses generated by counter A per trigger.  Use the internal output of counter A as the timebase for counter B.

 

So every time you get your external signal, counter A will generate N pulses which will be used to output a single period of counter B.  For the best results (minimum delay between the external trigger and the generated output) counter A should generate pulses as quickly as possible (100 MHz timebase, 2 ticks hi/lo, "Pulse Mode" instead of the default "Toggle Mode").

 

 

With Digital I/O:

You could configure a digital input task with "change detection" timing.  This can be used to generate a "change detection event" on each rising/falling edge of the external clock.  You could then use this signal to clock out a digital output task which will have alternating 1s and 0s in the buffer.

 

 

Best Regards,

John Passiak
Message 3 of 13
(6,805 Views)

Wait, it's digital input, not counter input, that has either-edge detection? Then yeah, I can have that clock a digital output task, and ta-da. I'll see if that does it - thanks!

0 Kudos
Message 4 of 13
(6,801 Views)

Okay, so I've got a Change Detection Event created off of the Digital Input line, but how do I connect it to clock the other line? The digital change event is, naturally enough, an event. Events go to software, and are not a valid timing source, unless I'm missing something.

 

And that's not unlikely.

 

http://zone.ni.com/reference/en-XX/help/371893D-01/6536and6537help/change_detection_event/

 

suggests that it issues a pulse. Oh...kay... on what line is that pulse issued? Can I hook it up to a PFI?

 

0 Kudos
Message 5 of 13
(6,787 Views)
Solution
Accepted by topic author LukeASomers

There's a hardware signal as well (which confusingly enough is called the "change detection event").  You can use it by setting your clock source to "/<device name>/ChangeDetectionEvent".  It won't show up in the drop-down menu for DAQmx termnals by default because it is considered "advanced" (see here).

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 13
(6,780 Views)

Thanks!

0 Kudos
Message 7 of 13
(6,760 Views)

I am interested in doing the same as OP, generate a pulse every time a trigger comes in for N triggers.  I'm not familiar with digital events and it's not obvious from the above discussion how the problem was solved.  Can you provide more detail?

 

My hardware:

PCI_6023E

0 Kudos
Message 8 of 13
(3,489 Views)

The solution used the Change Detection Event capability of boards 6535/6536/6537, so I don't know that this solution would work for your hardware anyway.

0 Kudos
Message 9 of 13
(3,481 Views)

There doesn't happen to be a counter that increments every time a task is triggered is there?  That would make this easy lol

0 Kudos
Message 10 of 13
(3,477 Views)