Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Reset ctr0 on USB-6009

Hi there!

 

We are trying to count a modulated 2MHz TTL pulse with an NI USB-6009 and LabVIEW 8.5.  It's my understanding that the USB-6009 is capable of this since the specifications say that the maximum counter input frequency is 5MHz.

 

I am experiencing a rather odd problem with the attached VI.  The VI is intended to display the value of the counter, then reset the counter when a digital line goes high by stopping the counter DAQ Assistant task.  The problem occurs once the counter has performed one successful count-up operation and has just been stopped (reset).  The loop then starts again to begin counting, however the counter appears to remain at 0.  I removed the loop delay and noticed that in this state the counter increments briefly then resets back to zero, despite the digital line for resetting remaining low.

 

Can anybody help me reset the counter to a state where it will function without reverting to 0 continuously?

 

Thanks,

 

Urveen

0 Kudos
Message 1 of 4
(6,995 Views)

Hi Urveen,

 

I've had a play around with the code you posted. I have witnessed the same behaviour as you. I unfortunately have no time left with a USB-6009 device that I was using but may be able to acquire another device at some point to try and continue this. I do have a couple of suggestions:

 

  • Move away from express VIs, set up the acquisition with lower level DAQmx funtions. I can post some example code if you need some advice on this.
  • You could use a case structure to decide whether to continue the aquisition, this may allow you to stop using the outer loop. Which will affect performance.
  • The wait times that you have for your loops are quite large. I would suggest using waits of 1ms.

Regards,

 

Chris

National Instruments - Tech Support
Message 2 of 4
(6,950 Views)

Hi Chris,

 

I followed your advice and had a play around with the DAQmx example "Count Digital Event.vi" and came up with a VI incorporating a reset function simply by using a compound OR gate and an additional boolean control to stop the inner while loop.  I've attached the solution for anyone's future reference, however I can't guarantee the quality of my work as I am quite a beginner with LabVIEW.

 

Now I will make a subvi for use in my main program.

 

Thanks for your help, and any feedback on this modification of the example DAQmx vi is greatly appreciated.

 

Urveen

0 Kudos
Message 3 of 4
(6,948 Views)

Hey Urveen,

 

The code looks good! If it is doing what you want it to do then I'd stick with it.

 

Best Regards,

 

Chris

National Instruments - Tech Support
0 Kudos
Message 4 of 4
(6,945 Views)