Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Starting & stopping DAQ-STC counter in continuous [double buffered] mode

I trying to develop an application using the Advanced Counter VIs and based on a number of examples from the knowledge base.
 
I've configured the counter for continuous acquisition [double buffered?] but would like to start and stop the acquisition process by first arming / disarming and then restarting with the prepare / arm commands to the Counter Control VI.
 
When I do this the first time and stop [disarm] the counter before the "Available Points" is less than the buffer size I can then read blocks from the buffer without any problems. However, if I then restart the counter with a Prepare / Arm sequence [which resets the available points to zero] and then again stop the counter with a Disarm command and try to read the buffer I get a buffer overflow error [#10846].
 
It seems that the only way I can do this is to programmatically perform a reset and then re-configure the counter to the required mode. As this seems somewhat cumbersome any suggestions or assistance is this regard would be most appreciated. Thanks in advance.
 
Jim
 
0 Kudos
Message 1 of 4
(3,812 Views)
Greetings Jim,
 
It sounds like you are using Traditional DAQ programming and an E-Series DAQ device for this application...is that correct? I would highly recommend migrating your program to DAQmx because creating a re-triggerable counter task is very easy and straightforward in DAQmx.  Take a look at the example "Gen Digital Pulse - Retriggerable.vi" in the NI Example Finder to see how this is done. 
 
If you need to stick with Traditional DAQ, I would recommend reading out all of the available data each time, so that no data is overwritten in the buffer.  This will avoid the error and you wont have to programatically reconfigure the counter each time. 
 
Regards,
 
Nicholas B
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,799 Views)

Hello Nicholas,

Thanks for the information - yes, I am using the traditional DAQ and the E-series board but, unfortunately, because of a requirement to support 'legacy' applications and products [LAB-PC+] it seems we have to stick with the traditional.

I think I may have figured out a way to do what was required without reconfiguring the counter after every disarm. It seems that what I was doing - after disarming the counter - was to either do a Program or Prepare / Arm sequence. In that case I would get the Buffer-Overflow error. If I simply restart the counter with Arm then I can continue to read the data - provided that the buffer does not overflow.

Also, in passing, I see that the Points-Available attribute seems to indicate the total number of counts that have been captured from the Prepare command which resets the value. The Arm command causes the Points-Available attribute to continue to increment even though the backlog shows substantially less. Would there be an application note or notes that provide some greater detail on the use and programming of these counters? Also any available information on the subroutines that are called by the CIN in the VI would be useful and appreciated as well.

Thanks again for the information & feedback.

Regards,

Jim 

0 Kudos
Message 3 of 4
(3,788 Views)
Hi Jim,
 
Glad to hear that we may have solved the issue.  As for documentation pertaining to counter applications, please refer to the E Series User Manual and Specifications, linked here:  http://digital.ni.com/manuals.nsf/websearch/3628030C3760BC108625711400785056  There is a lot of great device-specific and non-device specific information contained in the document, including an entire section on counters.
 
For more information on VI's, take a look at the context help and detailed help documentation in LabVIEW.  The context help window can be shown by pressing CTRL+H on the keyboard, or selecting Show Context Help from the Help drop down menu.  Hover over a VI with your mouse to see a description of the VI and its inputs and outputs.  Click on the "Detailed Help" link inside the context help window to bring up more information on the VI.  The detailed help document will contain links to other very useful information as well. 
 
Also, here are a couple other links to some online documentation that would be helpful:
 
 
Hope this helps...
 
Regards,
 
Nicholas B
Applications Engineer
National Instruments

Message Edited by Nicholas B on 08-16-2006 12:40 PM

0 Kudos
Message 4 of 4
(3,775 Views)