Hi,Now that you mention your triggering parameters, I think there are a few of other ways that we can achieve this. - I assumed that you were doing digital triggering and not analog triggering. However that does not change too much. All that we would need to do is internally route the ATCOUT signal, which is high when the analog trigger condition is matched, to the counter. This would make the code a little more complicated though. We would have to modify the "retrigger.vi" example that I posted in the last post to first of all replace the analog input with analog output and then we would also have to set up another analog input task, which is going to trigger on a analog edge and then internally route the ATCOUT to a counter. There is a much easier option though. From the code that attached in the last post it seems like you are not going with this method, since you would be needing to use all three of the counters. However, if you are using this method, please see the attached image of the retrigger.vi.
- Since your incoming signal is only 1Hz, what we can do instead is just restart the entire task after capturing a certain amount of samples. The reason I did not mention this before is because it takes a small amount of time to stop and restart the task, (in the micro second range), but since your trigger is coming in every 1 second, that gives us enough time to restart the task. To do this, you can just create a while loop around the entire code that you posted, and do a finite, analog triggered acquisition. There is an example in the example finder that will be able to do this for you. It is called Generate N updates - E Series - A Trig.vi. This however, is not going to achieve your requirement of stopping on a falling edge, if your falling edge is going to be consistently after a certain time (20ms) in your case, you can just generate only a certain number of analog output samples which will last 20ms.
- A last option is that we can also do
something like software triggering. We can just read this signal in
software and detect whether it is crossing a certain level and send the
output based on that. We can also stop the output based on the falling edge as well. This is not going
to be as accurate as hardware timed.
I think the second option might work out best for you. I have attached the VI for that and the screenshot is for the first option. Hope all of this helps. Please post back with any further questions.Best regards,
retriggerableanaloginput.png:
Loading Image...
anlogout.llb:
http://forums.ni.com/attachments/ni/170/280148/2/anlogout.llb