03-13-2008 12:42 PM
I am using NI
03-17-2008 06:42 AM
Hello,
It sounds like you are currently using an Analog Input task to measure the encoder lines. Are you limited to just using analog channels? National Instruments ships examples with Labview, which are located in the Example Finder under the Help Menu inside of Labview. Please take a look at the examples in the Browse tab under the folders <Hardware Input and Output> <DAQmx> <Counter Measurements> <Position>. These examples use a counter to measure the angular position for you. By using one of the examples that use a DAQmx Timing VI, you will be able to specify the "constant time step" with the rate supplied by an external clock or select a sample clock from one of the boards as sample clock source. The example would just need to be modified to write to a file.
The shipping examples that use a DAQmx Timing VI are the first three in the folder. I would recommend Meas Angular Position-Buffered-Cont-Ext Clk.vi.
03-17-2008 07:43 AM
Hello.
I am not limited to just analog channels. The NI USB-6211 has two counters and allows for z indexing. The angular position measurement uses both of my counters on the board so does that mean that I will be unable to use an internal clock or am I required to use an external trigger? When I write the angular position to a file how do I provide a time stamp to it? If I write an anaglog sample I just read my data as a waveform and that write the time and value but the counter does not offer that option.
Noel
03-19-2008 10:31 AM
Hello,
You can use either the ai/sample clock or ao/sample clock as the source for the DAQmx Timing.vi in the angular position example. However, you will need to run an AI or AO task in the background to enable and configure the sample clock. This would be considered a workaround to providing an external clock for this example.
I notice you are interested in a time stamp with the data. You are correct the angular position example does not provide timing data with the counter task. If you decide to use the angular position example with the AI sample clock, we could synchronize the counter task with the AI task via a trigger. (This would place the AI task in the same code and would eliminate the AI task running in the background.) Since they are using the same sample clock, timing data can be shared. Please let me know if you are interested in this setup.
I also wanted to note that the angular position example does not official use two counters. If you are creating the external clock by using a counter task to generate a pulse train, then yes the example will require two counters.
03-19-2008 01:02 PM
It is nice that you mentioned running a AI or AO along with the angular poisition because that was my next challenge. I've been trying to build my VI in small steps because I'm so new to LabView. I have added an AI to measure a voltage but I don't understand how I will synchronize that with my angular position. I've tried putting in a timer but I get the following error when I try running this. Could you explain to me how I would sync these two?
Possible reason(s):
Measurements: External sample clock source must be specified for this application.
Unspecified Property: SampClk.Src
Channel Name: Dev2/ctr0
Task Name: _unnamedTask
Thank you
Noel
03-19-2008 01:03 PM
03-19-2008 01:23 PM
I've pieced together some synchronizing from a random example posted on this message board. This seems to be giving me results that I am looking for but I was wondering if you could look at it to see if there is something redundant or inherently wrong.
03-20-2008 09:43 AM
It gives me the output I am looking for but I've found out that it is only able to run for 10 seconds before giving me the following error.
Possible reason(s):
Measurements: Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available.
Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped.
Attempted to Read Sample: 1000
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value:
Task Name: _unnamedTask<33>
I don't understand what is causing this error and I don't know how to correct this error. Any suggestions?
Thank you
Noel
03-20-2008 11:02 AM
03-20-2008 01:48 PM
Hello,
I do not think that you are doing any thing wrong or redundant. I am assuming that you have already fixed the last issue so your external clock is the internal ai/sample clock. I have attached a VI that has a slightly different sturcture than your last post. Please review and maybe add your File I/O. Please let me know if I am leaving any of your questions unanswered, since I am a little uncertain where you stand.