LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

analog comparison/start trigger

Is it possible to use the analog comparison (typ under start trigger) with a continous task that I want to start immediately?  I want to take samples from the get go, but then generate the analogcomparisonevent pulse when the values leave an analog window.  The way it seems so far is that it will only work if I use that as the start trigger, but then I don't recieve samples until that trigger is reached.
Any help is appreciated.
0 Kudos
Message 1 of 10
(4,235 Views)
Hi Michael,

For this application, I would recommend doing your analog acquisition with no triggering and generate the analog comparison event with a retriggerable counter output task that uses an analog start trigger with an APFI line.  Route your analog signal to both the analog input and the APFI line externally.

In the NI Example Finder, browse to Hardware Input and Output » DAQmx » Generating Digital Pulses » Gen Dig Pulse-Retriggerable.vi.

Combine this example with your continuous analog input program.  Let me know if you have further questions about how to do this.


Regards,
John Bongaarts
0 Kudos
Message 2 of 10
(4,215 Views)
How do you setup the analog comparison event with out using it as a start trigger?  My main problem was trying to figure out how to use the analog comparison functionality outside of using a start trigger.
0 Kudos
Message 3 of 10
(4,213 Views)
Hi again Michael,

You can also use a reference trigger, which allows you to configure  how many pre-trigger and post-trigger samples you want to acquire, but this only works with a finite acquisition.  If you want to continuously acquire and receive triggers, the reference trigger will not work very well.  Using the counter task will work because you can retrigger the pulse generation without starting and stopping the task.

There is no way to generate the analog comparison event without using a trigger at all.  It is the internal digital pulse generated by the analog triggering circuitry that actually triggers the task.

If you let me know a bit more about your application and what hardware you are working with, I could give you some ideas about how to achieve your goals.  Let me know.
Regards,
John Bongaarts
0 Kudos
Message 4 of 10
(4,205 Views)
PCI-6251 is likely the board to be used.
Tasks will include:
simultaenous sample of quadrature position + ~4 analog channels (using 1 counter as timing source started after the other tasks have started to correlate measurements)
Secondly, there is a torque input (one of the analog channels, can be routed to PFIA? line though as well).  I need a digital logic signal whenever the value is outside of a window to send to the motion card to stop the motion.
 
Thanks,
Michael
0 Kudos
Message 5 of 10
(4,193 Views)
Hi again Michael,

Here's what I'd do in your case:

1.  Set up the analog input task to be continuous.

2.  Set up the quadrature position encoder to be hardware timed as well, but use the AI Sample Clock for the clock source.  This way, you will still have one counter left and your AI and CI tasks will be synchronized.

3.  Set up a "dummy" Counter Output task to generate a single pulse that will be retriggerable.  You should be able to use the analog trigger from the AI channel or you can route the signal externally to the APFI line and use that to do the triggering.  You can use either the analog comparison event or the pulse generated on the Ctr1InternalOutput terminal as you are generating a retriggerable pulse anyway.  Either one should work.

Let me know if you have questions about this.


Regards,
John Bongaarts
0 Kudos
Message 6 of 10
(4,182 Views)
I don't think I can create an analog trigger for the counter.  I can only create start triggers for analog in or out channels.  How can I still seutp/generate the analog triggering without it being setup as a start trigger for my analog in task?
0 Kudos
Message 7 of 10
(4,180 Views)
Hi Michael,

My mistake.  You are correct that a Counter Task will not support an analog trigger.  I'm testing now to see if I can get the same idea to work with a dummy AO task instead of the dummy counter task.  I'll let you know if I'm able to get that to work.
Regards,
John Bongaarts
0 Kudos
Message 8 of 10
(4,160 Views)
Hi Michael,

I was able to implement the analog triggering using a dummy AO task. Once I can clean it up a bit, I'll post a small example of it.  I would recommend giving that a try and seeing if it works for you.  Another option would to create a software "alarm" that sets a digital line level based on the analog signal.  This would work depending on how quick of a response you need.  Multifunction DAQ is not ideal for active control loops, but it can do this well enough if you can spare some time for processing.
Regards,
John Bongaarts
0 Kudos
Message 9 of 10
(4,135 Views)
Hi Michael,

Here is the test code I used.  The AO dummy task is software retriggered, so how often you'd be able to receive triggers depends a lot on your CPU and what's running on the machine.  I hope it is useful.


Regards,
John Bongaarts
0 Kudos
Message 10 of 10
(4,051 Views)