Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6211 trigger question

Solved!
Go to solution

Hello,

 

I'm trying to send sawtooth AO signals at certain frequency and at each rising or falling edge, would like to send DO trigger signal out. I wired AO channel into AI channel and set DO to wait on AI signal as a trigger. I searched forum and read manual but it wasn't clear how to achieve this (it seems USB-6211 doesn't support Analog trigger). Any suggestion would be appreciated (been stuck for awhile with this problem).

 

Thanks in advance.

0 Kudos
Message 1 of 7
(3,703 Views)

I'd try using a counter to generate the DO trigger out.  Configure for units of "Ticks" and specify the AO sample clock as the "source of ticks".  Judicious choice of initial delay can help you set the phase, low and high ticks are used to set the continuing pulse intervals.

 

Note: If the desired placement for the rising edge isn't exactly 1/2 way between falling edges, you can still use the same basic technique but with different values for low and high ticks.  You'll also need to configure the somewhat obscure but occasionally useful DAQmx Export Signal property "Counter Output Event-->Output Behavior" and set it to Pulse rather than the default of Toggle.

 

 

-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).
Message 2 of 7
(3,670 Views)

Thanks for the reply Kevin. I tried your suggestion but I'm having hard time synchronizing those 2 signals. I've attached the VI (started from the example) and the screenshot of the scope. How can I correlate between ticks (high/low) and sample rates? My AO is a sawtooth (1024 samples) running at 80Hz and I want to have DO signals at every rising edge and/or falling edge.

 

Thanks again.

Download All
0 Kudos
Message 3 of 7
(3,649 Views)

1. It's important to sequence the Counter task to start *before* the AO task.

 

2. Your AO is going to regenerate, so you should make sure you write a waveform that represents an exact # of full periods.

 

3. For a sawtooth, the falling edge definition is clear enough, but I don't know what *you* mean by a rising edge.  Are you looking for the zero crossings?

 

4. Counter pulse params will all correspond to indices in the AO waveform data array.  Initial delay is is used to place the 1st pulse at the index of the 1st zero crossing. Then High Ticks places the 2nd pulse at the index of the 2nd crossing and Low Ticks gets you to the 3rd pulse and crossing (which should be at the same phase of the AO waveform as the 1st).

   I'd suggest writing a little subvi algorithm that'll take your AO waveform data and identify indices of zero crossings.  Then the differences between indices will be your pulse params.

 

 

-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).
Message 4 of 7
(3,639 Views)

Hello Kevin,

 

Thank you for more details but I'm still confused on how to determine high/low tick. The AO signal has 1024 data points for a single sawtooth shape (and repeat itself at 80 Hz rate or period of 12.5msec for each sawtooth and 12usec for each data point). Is one tick correspond to 12 usec (one data point)? In this case, high tick at index 2 and low tick at 1024?

Thank you again for the help. Really appreciated.

0 Kudos
Message 5 of 7
(3,629 Views)
Solution
Accepted by topic author jmdhk

Disclaimer:  I'm kinda old-school with the counters, been messing with them since before Y2K.  Over all those years, with many versions of hardware & drivers, there have been a variety of capabilities and behaviors related to triggered pulses and what's now known as "initial delay."   Since I'm ultimately going to do some verification measurements anyway, I usually just start there and do some quick experiments on my actual DAQ hardware to confirm the behavior I want.  It's more reliable than counting on my memory of various boards, modes, settings, etc.

 

So here's what I was *intending* to communicate, but you should double check that your particular hardware actually behaves as I suggest.

 

1. Yes, 1 Tick will correspond to 1 AO sample.  12 usec in your case.

2. Because you need a 2 Tick minimum value for any pulse param, you won't be able to place a pulse right on top of the 1st defined AO sample in your array -- it will need to be delayed by at least 2 Ticks.  Thus, you'll need to make a decision about your application.  I see basically 2 options to consider:

a. If AO *must* start at 0.0 volts (0 initial phase):  skip over the pulse you'd have liked to make at t=0.  Define "initial delay" as 1024 Ticks to place the 1st pulse at the 1st sample of the 2nd cycle of the AO sawtooth waveform.  Then set both high time and low ticks at 512. 

b. If 2 pulses are needed for *every* AO waveform cycle:  Define your AO sawtooth with non-zero initial phase angle.  I would probably use the sawtooth generator function at zero phase followed by a Rotate Array.  That'll be an easier way to define the exact # of Ticks worth of phase shift you're adding.  Then that same # becomes your initial delay value while high and low ticks are both 512.

 

Both of these suggestions are aimed at the idea that you'll place pulses at the zero crossings of the sawtooth.  Also assumed is that a zero phase sawtooth pattern has zero crossings at indices 0 and 512.  Experiment and measure to guard against off-by-one errors.

 

 

-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).
Message 6 of 7
(3,604 Views)

Thank you so much for the help. I was actually able to get it synced last night based on your previous suggestion. I used 2 ticks for high and 1022 for low with some initial delays. Restructured sequence as you mentioned and it all works great!

 

Thank you.

0 Kudos
Message 7 of 7
(3,598 Views)