Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to conditionally generate TTL signal based on an analog input?

Solved!
Go to solution

Hi there,

 

I am using NI PCI-6229 and LABVIEW 8.0,  and trying to develop a code that can generate a TTL/square function signal as soon as one analog input satisfies following conditions: 1. Crossing a certain value (say, 0 V); 2. Falling edge slope. The time delay between the crossing point and newly generated TTL/square signal will be critical in my measurement, and it should not exceed 1 millisecond. Any suggestion on it? Thank you in advance!

 

0 Kudos
Message 1 of 4
(3,980 Views)

Hi Matt11,

 

If you are using a PCI-6229 you cannot use analog triggering.  This means that you will have to use a software start trigger.  I can't give you a performance figure on how quickly a software trigger will respond because it depends on your computer and your VI.  To create a software trigger set up your two DAQmx tasks (one for the the analog input and one for your pulse generation) and have logic based off of your AI control the start trigger of your pulse output.

 

Here is an example of how to create a retriggerable software start trigger that outputs a pulses.

https://decibel.ni.com/content/docs/DOC-10682

 

If this does not meet your performance requirements you will have to use a DAQ card that supports analog triggering.

Regards,

Mike Altmann
Product R&D
NI
0 Kudos
Message 2 of 4
(3,965 Views)
Solution
Accepted by topic author Matt11

Hi Matt11,

 

If you don't mind using external ICs, you can use a comparator to accomplish what you are looking for. Some thing like the LM339 will allow you to compare your signal to a known voltage and tell you if you are above or below it. The output of the IC can be routed to a PFI line for the DAQ card to use for detecting the edge. In your case, set the reference voltage to be 0 volts. If your provided signal goes from positive to negative, a falling edge will occur on the LM339 output. If it goes from negative to positive a rising edge will occur. You can then use this signal as a digital trigger for your digital generation.

 

This method will be faster than the software trigger method since it is hardware. It is unlikely the software trigger method will give 1 millisecond performance, however this hardware method will be able to provide it.

 

Steven K.
National Instruments
Software Engineer
0 Kudos
Message 3 of 4
(3,951 Views)

Thanks to Mike and Steven for your suggestions! I will try first both options, software triggering and IC methods. I appreciate your time.

0 Kudos
Message 4 of 4
(3,944 Views)