Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Analog edge trigger to start digital output

Go to solution

Hi guys,


I use the DAQ 6361 with python to read analog ECG Data and to detect the R-Peak (highest Peak of the signal). If the R-peak is detected one of the digital outputs of the DAQ should write a digital pulse. Another device will detect it to start a meassurement but that is not a part of my task.


Right now I'm wondering if it is possible to detect the R-peak with the analog edge trigger. When this happens the digital output should wait for a specific time an then apply a pulse. Does somebody know if that is possible? I haven't found anything about that nor have I succeed implementing this idea. I have already spent so much time on that so I finally ask here.


Thanks for your help!


I have attached a screenshot of my code. It is definitely not complete!



0 Kudos
Message 1 of 3
Accepted by topic author skittlesgiraffe

At least conceptually, this should be doable b/c your device *does* support analog triggering.  I'm afraid I'm no help at all with the Python syntax, so I'll describe the main ideas.


1. The key is an internal digital signal known as the "analog comparison event" that becomes True when the analog triggering conditions are met.  In the case of an analog edge trigger, I *think* the analog comparision event will issue a brief pulse rather than simply toggling state (the way it would with an analog window trigger).


2. You'll need to configure a counter for retriggerable single pulse generation.  Specify the trigger source to be the "analog comparison event" terminal.


3.  Your counter pulse should be configured with both the initial delay and the low time set to the "wait" time you want.  The high time should be minimal, according to what the external equipment needs.  10 microsec should be plenty, 1 might be enough.

    (Initial delay is always used for the 1st pulse.  Low time is generally used for subsequent pulses.  Re-triggered pulse tasks complicates things and X-series allows further config options.  In many cases, such as yours, it's simplest just to set both values the same so you don't need to care which one gets used at which time.)


4. Remember that you'll need to keep servicing the AI task buffer to keep the task and the analog comparison event active. 


5. All this still means that you need to count on repeatability of the ECG signal.  You can't change the trigger threshold level on-the-fly without stopping and reconfiguring the AI task.  This might make it trickier to figure out a reliable trigger threshold -- you may have to make choices between allowing more false positives or more false negatives.



-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 3

Dear Kevin,


thank you very very much for your answer. That helped a lot and gave me the right direction and understanding of what to do!


0 Kudos
Message 3 of 3