Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

pci-6224 counter measurement

We need to make simultaneous counter pulsewidth measurements with our PCI-6224 DAQmx card.  It has two counters and the function panel info/help indicates specifically that it can do simultaneous measurements by creating 2 different tasks (DAQmsCreatTask()) and then using two separate DAQmxStartTask() calls.  We then do 2 separate DAQmxReadCounterScalarF64() calls. 
 
  The problem is that DAQmxStartTask()doesn't initiate the measurement like the function panel documention indicates.  The measurement(s) aren't initiated until the DAQmxReadCounterScalarF64() is executed, which makes simultaneous measurements impossible (i.e. if the measurement isn't initiated until the Read, then the first Read will be executing while both simultaneous pulses are generated and the second read will be too late).  I've put breakpoints in and verified this repeatedly.
 
  How do I get the DAQmxStartTask() to initiate the counter measurement immediately?
0 Kudos
Message 1 of 4
(8,612 Views)

Hi HeaveHo,

 

the DAQmxStartTask does actually start the task on the hardware.  The read simply reads the value from the buffer on the DAQ board.  You will not have the width of your pulse until the DAQmxReadCounterScalarF64() is called.  If you have both of your counter tasks started before your pulse arrives and an appropriate timeout is given, you will be able to capture the width of two different pulses on seperate lines.  I hope this helps clear things up!


Regards,

 

 

Dustin D

0 Kudos
Message 2 of 4
(8,598 Views)

I am experiencing the same problem. Did you manage to resolve it ?

0 Kudos
Message 3 of 4
(7,949 Views)

Hi nap3n,

 

What Dustin said is true of buffered tasks, but it sounds like the original poster is using an on-demand counter task, which is where the device starts counting when you call DAQmx Read. I think your best bet might be to use buffered tasks by calling DAQmx Timing (Implicit) like in the Meas Pulse Width-Buffered-Cont example. It may also be helpful to synchronize their arm start triggers, though implicit timing will still cause them to drift apart depending on the input signals.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 4 of 4
(7,941 Views)