Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Selective retriggerable counter output

I'm trying to set up a retriggerable digital pulse train generation on PCIe 6321 using ANSI C with the additional feature of selective triggering. I have a counter output task which will generate a fixed pulse train, and be set as retriggerable by a PFI line. There will be an external pulse train being supplied to PFI line. However, I want the counter output task only be triggered by even, odd, or every other fixed number of the triggers, is it possible to achieve that? Thanks.

0 Kudos
Message 1 of 6
(3,140 Views)

I don't believe it's possible within the DAQmx driver to only trigger every even, odd, etc. number of triggers. However, you should be able to code some logic to disregard or not write the data from triggers you don't care about.

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 6
(3,109 Views)

Thanks for reply. I understand that I can manipulate in the register callback function, but it will be subject to the software timing of callback. Hardware accuracy is the highest priority in my application. If it's not possible, can I introduce a filtering step to filter the external triggers by NI DAQmx? For example, the external triggers are coming in around 1 KHz, and somehow I can use NI DAQmx to filter down to 500 Hz. I find there are digital filters based on pulse width, rather than pulse frequency.

0 Kudos
Message 3 of 6
(3,101 Views)

1. A retriggerable pulse train already acts as a digital filter - once a pulse train is triggered, additional triggers will be ignored until the pulse train is completely generated and the circuitry is re-armed.

 

2. You could use an intermediary counter whose job is to react directly to the external trigger, and whose output will be used to trigger your generated pulse train.  To control based on # of incoming triggers, the intermediate counter would use the external signal as a timebase for pulse generation.  To control based on the time interval between incoming triggers, the intermediate counter would use the external signal as a trigger for retriggerable single pulse generation.

   Approaches like these would give you at least *some* of the flexibility you'd like.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 6
(3,090 Views)

Thank you , it seems your counter method might do the trick but I need further explanations if possible.

 

Let's say I want the pulse train to be triggered at the 1st, 3rd, 5th,...(odd number) of the external signal. Should I set this intermediate counter as a CI for counting on the external triggers and export a pulse at its counter output whenever Terminal Count reached? If so, then how to set this intermediate counter to use "the external signal as a time base for pulse generation" as you described? Even it can be done by CI, then how to count for the first pulse when set Terminal Count as 2? (I assume that changing Terminal Count value would introduce software timing which I would prefer to avoid.)

I believe that you have better idea of counter tasks than me, please elaborate more if possible. Thank you.

0 Kudos
Message 5 of 6
(3,079 Views)

I'd configure the intermediate counter for CO with the pulse parameters defined in units of "Ticks" (which means "active edges").

 

DAQmx requires a minimum value of 2 for high ticks, low ticks, and initial delay ticks.  That would normally mean you could only divide by 4 or more.  But there's a DAQmx property that defines whether the counter output toggles state or issues a brief pulse at the end of both low and high times.  The default is to toggle, but if you set it to pulse you can divide by 2 or more.

 

Unfortunately, you'd still end up with a system that responded to *even*-numbered triggers, 2nd, 4th, 6th, etc.  I don't have an immediate idea how to use the intermediate counter to make your main counter respond to the odd-numbered ones.

 

The main alternative that comes to mind is kinda messy and involves physical wiring.  You'd need to use an intermediate DO task that uses the external signal as a sample clock.  Then you'd define your DO data to create the high/low transitions at the right trigger #'s.  However you'd need to do physical wiring from digital port 0 (which supports hardware timing) to a PFI pin that the counter can route.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 6 of 6
(3,075 Views)