02-07-2019 05:55 PM
I have a 68 pin PCI 6221. I have an input signal with pulses (~1 us long, around 10 ms apart).
I would like to convert this pulse train to a 'square wave' by toggling a digital line at the rising edge of the pulse. Is this possible?
Alternatively, can I get this square wave on the analog out port?
Can I somehow use the counter -0 rising edge as a clock source for counter-1 and use pulse generation based on ticks on counter-1?
02-08-2019 07:18 AM
Yes, you can do pulse generation based on ticks. You need a minimum of 2 ticks each for high time and low time, so you'll end up dividing the incoming frequency by at least 4. This will only require the use of 1 counter, I'm not sure I follow your question about combining 2 counters.
There are 2 other approaches I can only briefly outline:
1. Use a DI task set for "change detection" sampling, sensitive to the incoming rising edge. Also set up a continuous DO task whose buffer is filled with alternating Trues and Falses. Run DO sampling off the DI task's "change detect event". Then every incoming rising edge causes a new DO sample to be generated, and your DO buffer defines those samples to alternately toggle the output state. The output will be at 1/2 the frequency of the input.
2. Use a counter set for retriggerable single pulse generation. Set pulse parameters with both low time and initial delay very minimal. Set high time to be half the known incoming interval (i.e. 5 msec, half of 10). This method depends on knowledge of the incoming frequency and its steadiness. It will produce an output that's approximately square-ish but not exactly. The output will be at the same frequency as the input.
-Kevin P