LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Catching pulses with NI USB 6341

Solved!
Go to solution

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.

0 Kudos
Message 1 of 7
(932 Views)

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 7
(903 Views)

Thanks, Kevin. Let me see if I got this right:
(Unfortunately my LabView is in German, so I put in some translations.)

 

Pulse_catch.png

 

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é

0 Kudos
Message 3 of 7
(880 Views)

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 7
(877 Views)

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é

0 Kudos
Message 5 of 7
(841 Views)
Solution
Accepted by topic author arockk

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 6 of 7
(837 Views)

This works now, thanks a lot.

 

-arocck

0 Kudos
Message 7 of 7
(808 Views)