06-15-2021 06:02 AM
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!
Solved! Go to Solution.
06-15-2021 08:28 AM
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
06-15-2021 08:41 AM
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
06-15-2021 11:04 AM
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