09-20-2022 12:53 PM
While programming analog test sequences at a circuit I came across the issue, that I need a simultaneous monitoring of a digital alert output, if a pulse (~1ms) happened while analog measurements are executed.
I have a USB 6341 in my test setup that I used for analog purposes so far. Is it possible that this device can do something like:
1. Configure one USB 6341 digital input continuously waiting for a pulse.
2. Executing test sequences with other devices.
3. Check USB 6341 if a pulse happened meanwhile and stop the further pulse acquisition.
This sounds very simple, but I am very new to the digital stuff and and got lost in the complex descriptions of digital functionalities in the manual and Google didn't help either.
Thanks in advance for your help.
Solved! Go to Solution.
09-20-2022 05:34 PM
Since you want this task monitoring for pulses in the background while your app does other things, I would very much recommend using a counter configured for "Edge Counting" measurement. DAQmx Timing should be set for Continuous Sampling with Implicit timing. (See the shipping examples that will illustrate this.)
Once you start the task, every pulse will increment the count register. This happens in the background whether you're interacting with the task or not. Then whenever you happen to retrieve the count value with a call to DAQmx Read, you'll get the total # of pulses since you started the task.
-Kevin P
09-21-2022 09:44 AM
Thanks, Kevin. Let me see if I got this right:
(Unfortunately my LabView is in German, so I put in some translations.)
1. Definition of the counter
2. Assigning the physical digital IO for which the pulses shall be counted
3. Setting the DAQmx timing as suggested by you
4. Starting the counting in background
5. Doing some other stuff
6. Reading the counter if it is >0
Does this make sense?
If I want to execute the pulse monitoring several times: Will a stop and start of the task reset the counter?
Kind regards, André
09-21-2022 10:11 AM
Yep, looks perfect!
And yes a stop and start will reset the count value. (Or you could hang onto the previous value and then look for a change on the next read. Either can work.)
And to help build good habits, don't forget to call DAQmx Clear when your app is all done with the counter task.
-Kevin P
09-26-2022 11:36 AM
Ok, this took a moment because I had to modify the hardware to have the physical counter input available.
Unfortunately the execution of this sequence failed already at task start with:
Error -200300 at DAQmx Start Task.vi
Possible causes: Invalid timing type for this channel.
Property: SampleTimingType
Requested value: Implicit
Possible values: Sample Clock, On Demand
Any idea?
-André
09-26-2022 11:50 AM - edited 09-26-2022 11:53 AM
Sorry, my fault. I got myself mixed up thinking about another thread involving counter *output* where Continuous Sampling and Implicit timing *would* apply.
For your situation (input task where you read the count on-demand sometime later), you should simply remove the call to DAQmx Timing. You can see this usage in a shipping example for edge counting (the one that doesn't mention a clock).
-Kevin P
09-28-2022 05:42 AM
This works now, thanks a lot.
-arocck