11-11-2008 06:48 AM
Hello everyone,
I'd need to trigger a sequence depending on a ramp (sawtooth). Right now, I use the attached sequence in the first frame of a while loop. In each iteration, it reads the input voltage (which is just a double value) and compares it to a preset value with TRUE beind redirected to the stop terminal when the given number is lower than a premade number (-0.9 here). This is a rather dirty solution, I'd like the while loop to cancel on the rising flank, meaning when the current value is bigger than the value in the previous iteration.
Could someone give me some hints on how to achieve that?
Thanks in advance.
11-11-2008 07:25 AM - edited 11-11-2008 07:26 AM
ReBoot,
Try using a shift register to hold the last iteration data and make it available for comparison. Might look something like this.
11-11-2008 07:28 AM
11-27-2008 06:43 AM
12-01-2008 07:13 AM
ReBoot,
A couple of things to check. Is the ramp signal you are sampling noisy? Did you start the DAQmx task outside the while loop?
12-02-2008 01:09 AM
12-02-2008 10:29 AM
12-04-2008 06:39 AM
12-04-2008 07:25 AM
12-04-2008 09:07 AM
ReBoot,
You are acquiring a series of data points an then looking to see if any of the points was the start of the rising edge. That won't work. You need to be analyzing each point.
Attached vi demonstrates how you could use a shift registers to accomplish this. The boolean shift register acts as a trigger enable and will not allow a rising edge to be detected until a falling edge has been first detected. Note that the DAQmx Read is 1Chan, 1Samp. This vi will only work for fairly slow signals. If you need to handle higher frequencies or need better response time, then I suggest you look into using an Analog Trigger for your task. Please note that this feature is not available on all DAQmx devices.