06-05-2025 04:01 AM
Hello,
I would like to use a DAQmx PCI/PCie device to monitor three digital TTL signals and simultaneously monitor an encoder (motor/slide with encoder).
So, I have four inputs:
1. TTL Input 1
2. TTL Input 2
3. TTL Input 3
4. Quadrature Encoder Signal (Track A and Track B)
Now I want DAQmx to monitor the signals in hardware, and as soon as an input changes, it should send me a message or throw an event.
With this event I would like to know
1. which of the TTL signals changed
2. chaned from high to low or from low to high?
3. what was the encoder count at this time
And no information should be overwritten or lost.
What do I need this for?
Suppose a sensor has three reed contacts. I want to mount the sensor on a handheld or motor slide with an encoder and move it back and forth (quickly) by hand or motor.
And now I want to know at which encoder value (resolution, e.g., 1/100 mm) which reed contact changes.
btw the contacts are bouncing.
Is this possible with DAQmx?
For example, I have the NI PCIe-6323 card here.
Is something like that even possible?
Can this be made HW clocked on DAQ side?
I found this: Getting Started with DAQmx: DAQmx Events - NI
and this: DAQ_Digital Edge Count Measurement Library - NI
But I don't know if this is applicable for this application.
Thanks and best regards
EW
Solved! Go to Solution.
06-05-2025 06:09 AM
Here's what'll get you 95%+ of the way there.
1. Configure a DI task with the "Change Detection" method for sample timing. Your 3 TTL signals should be part of this task and you can specify whether to detect rising edges, falling edges, or both.
2. You likely need to wire those signals into Port 0. That's typically the port that supports hardware timing for digital signals.
3. Configure your encoder signal to use a special internal signal known as the "Change Detection Event" as its sample clock. In LabVIEW, you'd go to the DAQmx Timing node and right-click the 'source' input to create a DAQmx Terminal constant. Then right-click the constant and choose "I/O Name Filtering..." from the popup menu. Then check the box to Include Advanced Terminals.
After all that, you'll be able to find and select the "Change Detection Event" as the source signal that acts as a sample clock for your encoder task.
For 4 of the other 5% (essentially, this is about establishing the initial DI state *prior to* any change detection samples), read through this thread for some ideas.
For the final 1%, you may want to consider triggering the encoder task so that you aren't accumulating an arbitrary amount of counts prior to the first TTL signal transition. The method I would use is to trigger off the same change detection event BUT make sure you trigger off the leading edge of the pulse and sample off the trailing edge.
Offhand I don't know if the pulse is active high or low, you may need to experiment to figure out whether the leading edge is rising or falling.
-Kevin P
06-05-2025 06:13 AM
Thank you very much Kevin!