Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I store the output of a Quadrature Encoder?

Hello Group

 

Back with a new problem, I have added an Quadrature Encoder to my project and can view it in my Scope charts with other data.

Now later when I go to read this data I get only one line of data for the enccoder with my other data.

When I try to display this file with my waveform I get just one vertical line. If I remove the encoder from the write to file line I can now see the scope chart waveform.

Any ideas for a solution

 

 

I am using Labview 8.6 with a PCI-6220 card and an SCB68 interconnect box

 

Here are the vi I am using

Data_recoder_Video5a has the encoder connected

Data_recoder_Video4B does not have an encoder tied to the write to file

May display is Display4a without the encoder

the display with the encoder is Display5a

 

Here are the data files I am using from my capture

Without encoder 4-07-11.lvm

With the encoder is 4-07-13.lvm

0 Kudos
Message 1 of 9
(3,741 Views)

I could not add the last display vi and the data file here they are

 

I changed the (.lvm files to .txt to send)

 

Thank You

 

Richard

Download All
0 Kudos
Message 2 of 9
(3,739 Views)

Hi Richard,

 

The complexity of your code makes it very difficult to see exactly what's going on and help you look into this.  Could you simplify the code down to the smallest piece that shows this behavior?

 

Also when creating a VI that others will look at, it really helps to have an organized layout, straight wires, and labels over any potentially confusing parts of the code.  You did an excellent job labeling the Express VIs, however it is extremely difficult to follow the wires going to and from them.

 

If you could reduce the code down to an extremely simple version that still displays the same behavior it will be a lot easier to figure out why it is happening.

Eric S.
AE Specialist | Global Support
National Instruments
0 Kudos
Message 3 of 9
(3,720 Views)

Eric

I have made 3 basic vi of what I am tring to do.

The first is with the Encoder the second is without and the last is the display VI

 

The txt file I sent earlier will show the problem in the display.

 

This problem some how got in the program after we have been doingruns and not checking the display files.

The encoder is a Celesco SE1-25

 

Thank You for your help

Richard

Download All
0 Kudos
Message 4 of 9
(3,707 Views)

Hi RAL,

 

It looks like when you were setting up your Encoder task you have it set for "1 Sample (On Demand)" timing, whereas with the other task you have it set for "N Samples" reading 100 points at 400Hz.  This means that for every iteration of your while loop you will have 1 sample from your encoder, and 100 samples from your other voltage task which are written to the measurement file.

 

If you change the timing properties for your encoder to have the same 100 points at 400Hz you will have the same number of points for your encoder as well.

Eric S.
AE Specialist | Global Support
National Instruments
0 Kudos
Message 5 of 9
(3,684 Views)

I have tried to change the Acquistion Mode to N samples and set Samples to Read at 25 (What we are using now) and Rate at 800 (our new Rate)

But when I click ok I need to set a sample clk Type  (my clock is now External) What do I use for a Clk source there are several and most will not run when I try to run my Program (vi)

I have tried the Di/SampleClk, the Do/SampleClk, Most the time  I get Measurements: Sample Clock Rate must match the frequency of the internal timebase specified as the Sample Clock Source.

To use the specified Sample Clock Rate, set the Sample Clock Source to OnboardClock. To use the specified timebase as the Sample Clock, set the Sample Clock Rate to the frequency of that timebase.

Sample Rate: 800.000000
Source Terminal: 20MHzTimebase

Is there a way to set the clock for the encoder?

 

Richard

0 Kudos
Message 6 of 9
(3,672 Views)

You can actually use ai/SampleClock.  This will mean that every time your analog timing engine acquires a sample then your counter will acquire a sample as well.  It is also on purpose that the AI sample clock is the same rate that you want to acquire the encoder signal as well.

 

I also want to highly recommend moving towards using the DAQmx VIs instead of the Express VIs.  It is a lot easier to explicitly see how tasks relate to one another and set up more advanced features such as synchronization and triggering.  You can check out examples in the NI Example Finder (Help » Find Examples) and then navigate to Hardware Input and Output » DAQmx then browse the Analog Measurements, Counter Measurements, and Synchronization»Multi-Function folders for examples of these tasks using the DAQmx VIs.

Eric S.
AE Specialist | Global Support
National Instruments
0 Kudos
Message 7 of 9
(3,653 Views)

One more time

I tried the ai/Sample clk but always had an error of waiting for a input to finish, I could not use this in my vi.

I have tried using the DAQmx section and had what I thought was a working solution, Until I added two analog inputs for pressure then I still get only one encoder input for each 25 samples.

I am using a rate of 800 and taking 25 samples for our runs

Here is what I have tried so far, Just a short verison of the main program.

I need to be able to display the linear encoder position with the other traces.

I have two different way I was looking into, The second one I was not sure what type of ext clk to use

None of the samples I could find to test would work.

 

 

Any ideas of what is wrong.

Download All
0 Kudos
Message 8 of 9
(3,622 Views)

Excellent job exploring the use of DAQmx VIs, however it's tough to use both DAQmx VIs and the DAQ Assistant at the same time (express scaling VIs are still OK)

 

I decided to write a community example which I will put up on the NI Developer Zone Community later today that synchronizes analog input and encoder counter measurements. 

 

Attached is the VI.  This measures an angular encoder and analog input, synchronized at the same rate, and outputs the data returned on the same plot.

 

in your example you will still have to extract and add those two scaling express VIs to the code.  They can go right after the Analog DAQmx Read.  Use Index Array to extract the waveform for your two signals, then wire those into the scaling VI, and then combine them back into an array to use in the rest of the code.

 

Let me know if this is able to work. 

 

Eric S.
AE Specialist | Global Support
National Instruments
0 Kudos
Message 9 of 9
(3,596 Views)