Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

buffered position measurement

Gathering position data from optical encoders very quickly. Hence I am using the buffered position measurement.vi as a basis. But when the gate signal calls the buffer the value of the buffer shown appears to be the last value read into the buffer. How can I get the entire data contained within the buffer upon execution with the Gate signal. I could then ideally stream this to disk and post process the data.
0 Kudos
Message 1 of 3
(3,519 Views)
bigburnsgeoff,

It sounds like you want to read all of the position data from the counters, incrementing and decrementing. Thus, you can actually just do a simple position measurement instead of a buffered position measurement. In the LabVIEW >> Examples >> Daq >> Counters >> ni-tio.llb directory, you will see the Measure Position example. The data is continuously read and shown in the indicator in the while loop. You would not need a gate signal for the counter, as you would in buffered position measurement.

You can wire from that indicator out of the while loop with Indexing Enabled (right-click on the tunnel created by the wiring) to capture all the iterations of the while loop when it's completed into an array and then do processing as the counter operation
ends.

Regards,

Geneva L.
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 3
(3,519 Views)
Am not sure exactly what you mean by, "when the gate signal calls the buffer...". Here are a couple tips though. I am assuming that what you want to do is size up a big old buffer, capture a whole bunch of data, dump it to disk all at once, then post process.
1. When configuring your counter buffer, be sure you set it for 'single' mode. This way, if you overrun your buffer, the extra gate signals are essentially ignored. In 'continuous' buffer mode, the error cluster boolean would get asserted.
2. Once your acquisition starts, you need to wait until you've captured all the data you want. While you *can* do this by setting an appropriate time limit on 'Counter Buffer Read.vi', I've preferred a more flexible approach that goes something like this: Inside a while l
oop use 'Get Attribute.vi' to query for 'available points'. You can bust out of the while loop under any desired combination of the following (or other) conditions:
a. you've filled the buffer (i.e., the # of available points == the buffer size.
b. you've looped around for too long a time without seeing the # of available points change
c. some user interface action can force a premature read
d. an acquisition error occurs
e. etc.
3. use 'Counter Read Buffer.vi' to read your whole buffer. I generally specify 'number to read' as the minimum of (buffer size, # available points). This is important with continuous buffering, though it may not be needed with single buffering. In any case, it won't hurt you.
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 3 of 3
(3,519 Views)