Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Toggle digital line using counter

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?

 

 

0 Kudos
Message 1 of 2
(1,707 Views)

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 2
(1,683 Views)