03-16-2018 06:35 AM
Good morning,
I am working with a USB 6221 DAQ and my goal is that of generating a digital output when a trigger from an external photodiode arrives at the DAQ. The problem is that, due to the high frequencies of the signal output by the photodiode, I need not to have any software or windows delay, so that I need just the DAQ to handle the trigger and output a predetermined digital waveform any time it receives it from the photodiode.
It has been two weeks now that I am trying with no results, can anyone help me?
Thank you in advance
Solved! Go to Solution.
03-16-2018 08:07 AM
Try starting with something like this...
-Kevin P
03-20-2018 10:52 AM
Thank you, it works as expected, but now I have a further question, is it possible to trigger the counter both on a rising and a falling endge? i.e. I would like to output a trigger which has double frequency wrt the one used as PF.
Kind regards
03-20-2018 11:15 AM
Are you sure the photodiode signal you're using as a trigger has the right characteristics for this? To get a frequency doubling effect, you'd need to rely on the raw trigger signal to repeat with a constant rate and a 50% duty cycle.
That said, you can't directly configure a DAQmx task to trigger off *either* edge, you have to identify 1 specific edge polarity.
Two options:
1. fairly simple external circuit that would turn any digital edge into a brief digital pulse
2. an indirect and fairly complicated DAQmx configuration involving a dummy change-detection based DI task, and a counter task that triggers off an internal "change detect" signal. I don't have time at the moment to describe it in full detail.
-Kevin P
03-21-2018 03:52 AM
That's the point, the photodiode outuputs a signal which suffer from a jitter, so that it is not the best solution to put a software delay in the software DO generation, but it would be better to trigger the clock also on the falling edge and not only on the rising.
I have not well understood your second solution, I didn't know one could do such a thing using a counter, but I will work on it.
Thank you again for your time and kindness.
Kind regards
03-21-2018 12:51 PM
This is an outline of my 2nd solution. Not complete, not tested, but meant to give you a decent headstart in the right direction. It's a "snippet", so you can save the png file and then drag it into an empty block diagram and it'll turn into code.
-Kevin P
03-23-2018 11:22 AM
good morning,
your answer was really useful and I am almost done with my software.
Now I have a last problem to face, which is that of delaying the digital output of the DAQ.
In order to do that, I tried to use DAQ.mx trigger delay, which is supported by the USB 6221 I am using, but it keeps giving me error:-200452, that is
Property Node DAQmx Trigger (arg 1) in Flow OPT (GS3+PI)_Gianmaria_chopper_2f.vi <append>
<B>Property: </B>Start.Delay
In the attachment you can find a snippet of my code, what am I doing wrong?
Kind regards and thank you in advance
03-23-2018 01:06 PM
I haven't seen (nor tried to use) those trigger properties on a counter output task before. Typically what's used is the "initial delay" pulse parameter which can be wired at the bottom of "DAQmx Create Channel.vi".
Unfortunately, the behavior is different for the 1st trigger than for all others. This article gives some explanation and guidance about a workaround. Essentially, you'll need to split your single retriggerable finite pulse train task into a pair of counter tasks. A little further complication, but it should be able to work.
-Kevin P
04-10-2018 05:56 AM
Good morning Kevin_Price,
I tried again as it is showed in the two snippets attached to this post, but still it is not working, resulting in an error:-50103.
I have one task for signal generation (trigger task), one for chopper signal detection (Dummy task1) and the two counters: the first oscillating at frequency that doubles the one of the chopper, the second that oscillates at the same frequency as the first, but it is translated by a phase factor (and therefore a time interval that variates in time since f_chopper is not constant), inserted by the user.
I have no idea why it does not do want I want, any help would be much appreciated.
Thank you in advance
Kind regards
04-10-2018 10:00 AM
Don't have time to fully re-digest the entire thread. A few things popped out in a quick comparison of your first config pic to that shown in the article I linked in msg #8.
That's all the time I've got now.
-Kevin P