From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

MIO 6601 Counter, Perform Buffered Read and Simple Read

I have an application written in C++ where I would like to use the 6601 as the time base for all of the boards, so I would like to be able to query the current value of the counter. I also have a external signal that I want time tagged in the buffer. I have used example programs for the Simple Read and the Buffered read and they both work successfully individually.

If I try and combine them by setting up the counter with the following statement:

iStatus = GPCTR_Set_Application(iDevice, ND_COUNTER_3, ND_BUFFERED_EVENT_CNT);

and try to read the current value of the counter with:

iStatus = GPCTR_Watch (iDevice, ND_COUNTER_3, ND_COUNT, puiCurrentTime);


I always return a 0 for puiCurrentTime.

Can
I do both with a single counter? If not can I synchronize two counters one setup for the buffered read the other for the simple read.

Thanks
0 Kudos
Message 1 of 3
(2,280 Views)
The second NIDAQ function call (GPCTR_Watch) will not work with Buffered Acquisition, because it is designed for simple read only. That might be the reason why puiCurrentTime always returns a zero.

Regarding the second issue, you can do both tasks with a single counter, by configuring it as buffered first, and completing the operation, and then configuring it as single, and completing also the operation. Nevertheless, there is no way to configure it as buffered and work with it as single reader, or viceversa. You must use two for performing an operation such as that. Thus, if you want to synchronize both of them, I would suggest you to read the following document which talks about it.

Well, I hope all of this info is helpful for you.

Aguila
0 Kudos
Message 2 of 3
(2,280 Views)
I have read the link you suggested and it contains some very useful information. The issue I still have is how do I trigger the buffered read counter when the gate is already used by the event. It appears that it might be possible to use the aux line as an additional gate, but I can't find information about how to configure this line using c++.

I think my ultimate solution would be to use a digital IO line to start both the simple counter and the buffered read simultaneously wired to the gate of the simple counter and the aux line of the buffered counter. Then have the gate of the buffered counter by toggled by the hardware event that I want timed.

Does anyone know if it is possible in C++ to configure the counters in this way?

Thanks again fo
r any help.

Bob
0 Kudos
Message 3 of 3
(2,280 Views)