03-27-2019 03:46 AM
I am using NI ELVIS II device, I have a digital input signal. I want to catch the event when this input signal changes from HIGH to LOW, I don't care how many counts. To do this, I used a local variable (as in VI attached) but I think it is still not the most optimal. Do you have any other way to replace my plan and speed up it? Thank you.
03-27-2019 06:10 AM
Hi hung,
using local variables in a loop is NEVER a good idea!
What about using shift registers instead?
What about that (classic!) Rube-Goldberg in your VI?
IF true THEN true ELSE false
That is basically a NOP…
When your loop runs endlessly, then those DAQmxStopTask and DAQmxClearTask will never be called…
Do you have any other way to replace my plan and speed up it?
Yes, sure!
Use the DI signal as a trigger for the second task. Start the second task on a falling edge of the first DI signal…
To learn about that DAQmx feature you should look at the example VIs in the example finder, coming with LabVIEW!
03-27-2019 07:13 AM
Hi GerdW,
Thank you for the things you said very interesting. The algorithm that uses local variables as I did before is due to thinking like the previous C/Arduino programming language I used. As you said, Use the DI signal as a trigger for the second task. I tried searching for example
I don't know if this is an example you want me to find.
03-27-2019 07:56 AM
Hi hung,
please see the example "Analog Input - Synchronization": there is a StartTrigger at the 2nd DAQmx task.
You need to do the same with your DI task: set the first DI signal as a start trigger - you can even select the edge of the DI pulse…
03-27-2019 08:00 PM
Hi GerdW,
I tried trying to read the example and look for more examples online. But in the example "Analog Input - Synchronization" I don't understand how it works.
I found an example on google but also could not understand how it works. Can you help me make a simpler example? I have been studying labview for 2 days, I see examples that are too difficult. Thanks you!
03-27-2019 09:27 PM - edited 03-27-2019 09:49 PM
Hi GerdW,
I just wrote an example, you can help me see if it works properly: "when the Master Channel has an Input pulse from high to low, the Slave Channel has an output pulse from a low level to a high level." Thank you.
03-28-2019 03:13 AM - edited 03-28-2019 03:14 AM
Hi hung,
you don't need that "master" task.
All you need is to set the correct (PFI) channel for this DAQmxTrigger…
I have been studying labview for 2 days, I see examples that are too difficult. Thanks you!
That's why there is a "Training" section in the header of thisLabVIEW board.
You really should take that!
You want to cope with DAQ hardware, so you better do some training before starting to code…
03-28-2019 10:39 PM
I have a NI-ELVIS II device. I want to read an input analog signal when there is a digital input signal from a high level to a low level. I use DAQmx Triggers to do that. Analog signal my input connected to AI0 + -, digital input signal connected to FPI0. But I can't read anything, can someone help me? Thank you.
03-29-2019 01:47 AM
I have a NI-ELVIS II device. I want to read an input analog signal when there is a digital input signal from a high level to a low level. I use DAQmx Triggers to do that. My Analog signal input connected to AI0 + -, digital input signal connected to FPI0. But I can't read anything, can someone help me? Thank you.
03-29-2019 02:01 AM
Hi hung,
why did you create two more threads for the very same topic? Please keep discussions in one place (for one problem)!
But I can't read anything, can someone help me?
- You didn't set any trigger source, the DAQmx channel control is empty.
- You set the edge to "rising", but from your description you want to wait for a "falling" edge.
- You didn't set any number of samples to read.
- You set the acquisition mode to "continuous" (which is fine), but only call DAQmxRead once. IMHO there should be a loop around DAQmxRead.)
- Do you get any DAQmx errors? If yes: which one?
- Did you connect your digital signal to PFI0?