04-27-2010 06:51 AM
Hi,
I'm not sure this is possible but i'd like to route the outputs of 2 counters (PCI-6602) to the same Digital Output line.
My 2 counters each generate a pulse train defined by frequency, dut-cycle and delay. I want to combine the 2 pulse trains into one resulting pulse train. How would this be possible if I can't route the outputs of the counters to the same digital line ? Do i have to abandon this idea and define the desired pulse train in binary and repeatedly output that to a digital line ?
Many thanks in advance for any feedback here.
Cheers, Shaun.
Solved! Go to Solution.
04-27-2010 07:55 AM - edited 04-27-2010 08:03 AM
Hi Shaun,
I do not recommend you to connect 2 outputs directly.
Why don't use a 2-input OR-gate? Connect the counter outputs to the inputs of the gate.
If the pulses are nicely timed and synchronized (they do not appear at the same time)
the output of the OR-gate will be a combination (sum, actually) of these pulse trains.
Hope this helps,
04-27-2010 08:14 AM
Thanks for replying Ebalci,
I was thinking about doing something like that. Given the nature of the signals there will be times when the pulses overlap but still I think I could get away with an OR gate.
I was just wondering if such low level logic is available on the actual board rather than having to add seperate components. I simply thought producing a complex pulse train from two simple counter pulse trains would be a quick 'n easy solution.
Cheers, Shaun.
04-27-2010 11:37 AM
In the end I configured a counter for Pulse Train generation and opted to change the duty cycle and frequency via 'DAQmxWriteCtrFreqScalar" (i.e. Pulse Width Modulation)
I registered a callback for the 'DAQmx_Val_CounterOutputEvent' and then changed the dutycycle and frequency in that callback.
Unfortunately, I kept getting "The pulse generation with previous property settings must complete a full cycle before the property can be updated." error messages and, opon further reading, managed to find a doc where National Instruments suggest adding a 'Wait(period)' before executing the 'DAQmxWriteCtrFreqScalar' call.
The problem with this solution is that it one has to wait a minimum of 2 Periods before the Pulse Train can be modified which is not acceptable for our work.
So is there an alternative solution which allows us to change the Pulse Train after only 1 Period ? Is there an event we can trap which allows us alter the Pulse Train after every period ? I'm sure PWM must be possible on Daq cards (PCI-6602 or PCI-6281 or PCI-6259)?
Cheers, Shaun.
04-29-2010 06:19 AM
The last solution posted was not ideal. Alas we're returning to using 4 counters on a TIO-6602 and an external OR gate to logically OR the outputs from each pair of signals into two composite signals.
Just curious though, do NI DAQ cards and/or TIO cards have any logical gate arrays on them ?
Cheers, Shaun.