Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing TTLs from 2 different DAQs

Solved!
Go to solution

I have a 3kHz pulse coming from a PCI-6110 and then I generate a ~0.5Hz pulse on a USB-6341.

 

I would like to make it so that the second pulse is triggered by the first pulse so they are in sync, which I can do, but there is more to it.

 

Basically, the first TTL is the line clock of an imaging system, and each frame has 256 lines. I want the second pulse to be in sync with whole frames, i.e. not go high or low mid frame.

 

So perhaps what I need is for the second pulse comes on for some multiple of 256 lines (the number of lines in a frame) that is close to 1 second.

 

I know these numbers in advance, so for a 3kHz first pulse, 1 second of on time would be 3000 pulses, or lines. To make it a whole number of frames, it would be reduce to 2816 lines (2816 / 256 = 11 frames). 

 

So I want the second pulse to come on for 2816 line clock pulses, and then off for 2816 line clock pulses.

 

I use python but I think I just need the general concepts to get it to work.

 

Thanks in advance!

0 Kudos
Message 1 of 4
(904 Views)
Solution
Accepted by tristan256

1. The key is to configure the slow pulse train in units of "Ticks" (a.k.a. active edges) of the nominal 3 kHz pulse train rather than in terms of time or frequency.  Then you can configure directly for 2816 high ticks and 2816 low ticks.  (Note: it'll be important to start the slow pulse train task *before* starting the 3 kHz pulse train.)

 

2. It looks like you've got the math part understood for finding an appropriate integer # of frames worth of ticks.  Did you have any questions there?  You got 11 frames by rounding down, and that might be important in your app.  In case not, rounding to nearest would give you 12 frames or 3072 Ticks.

 

 

-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 4
(870 Views)

Hi Kevin,

 

Thanks for your quick reply!

 

1. Ok so in python there is a function add_co_pulse_chan_ticks that I can use to set up the counter pulse based on line clock ticks coming from the other NIDAQ, rather than time. Then there is a parameter called source_terminal which I'm guessing is where I should connect the line clock - does that sound right?

 

2. No I think this is ok, just thought I'd explain the detail to make it clearer, in case there was some other better approach.

 

Cheers,

Tristan

0 Kudos
Message 3 of 4
(861 Views)

1. Yeah, that sounds right.  I don't do python, but one little detail that's come up in the past is that terminal names need to start with a leading '/' character (whereas channels don't).

Example:

PFI 4 as a terminal: "/Dev1/PFI4"

Counter 0 as a channel: "Dev1/ctr0"

 

 

-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 4 of 4
(852 Views)