Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulating Synchronous AI Read Data

Hello,

I'm having some trouble manipulating data obtained from the AI Read function. I've used 25114.vi to obtain synchronous position and voltage readings, however, instead of simply outputting the result to a waveform chart, I'd like to do some conversions on the position data before I use an XY graph to display the position-voltage readings. I've found this very difficult to do, since the AI Read function outputs a 2-dimensional array with only a single value (voltage at index 0,0) without mention of the position data. Apparantly one index is used to select channel and the other is for the data point number but it seems I cannot manipulate the array to yield a 1d array of position and a 1d array of voltage. The help indicates that one should transpose the 2 dimensional scaled array before graphing but transposing [0,0] isn't going to help much.

Any help is much appreciated,

Thanks
0 Kudos
Message 1 of 14
(4,750 Views)
Hi!
 
Whenever you run this VI, do you see both position and voltage data on the graph or just the voltage from the specified channel(s)?  It looks like the VI you are using is reading a voltage at each encoder step, but it does not look like it is actually reading the position, just using the encoder as the sample clock.  You will probably need to have a VI that displays the encoder position at each clock pulse.  Also, is there a specific reason you are using this VI with traditional DAQ over the Motion/DAQmx examples in LabVIEW's Example Finder? 
Carlton
CLA
0 Kudos
Message 2 of 14
(4,716 Views)
Hi Carlton,

When I run this VI I only see the voltage data and that's my problem. I think you're exactly right about it not actually reading the position but rather using the encoder as a sample clock. The VI itself can be found at http://zone.ni.com/devzone/cda/epd/p/id/4660. I was previously unaware about the example finder and am now browsing the multi-device DAQmx synchronization examples. Any recommendation on a particular example or further information you can give me would be appreciated.

Thanks very much,

Ryan
0 Kudos
Message 3 of 14
(4,703 Views)
Hello!
 
There are two examples in the Example Finder that are very close to what you were using from the website and the examples are also using the new DAQmx instead of Traditional DAQ functions.  Here are the names of the examples you can look at:
 
RTSI with DAQmx (encoder-external scan clock).vi
RTSI with DAQmx (encoder-external scan clock Continuous).vi
 
The first example is used if you know the number of samples you would like to take and the second just runs continuously.  These examples, like the VI you were using, do not specifically read the encoder position but use it as the sample clock.  You could simply add a VI to read the encoder position at each DAQmx Read iteration and plot the two together.  In the Vision and Motion palette there is a VI called Read Position.flx in which you could have run in parallel with the voltage read so each time a voltage measurement is taken, the encoder position is read.
Carlton
CLA
0 Kudos
Message 4 of 14
(4,696 Views)
Hi again Carlton,

After downloading one of the examples I noted that it required at least labview 7.1 to run... So I've tried uninstalling my current version and then installing 8.2 but it now seems that I'm missing lots of VIs from the library as well as DAQmx... It's quite frustrating.
0 Kudos
Message 5 of 14
(4,667 Views)
Good afternoon,
 
In order for the VIs to show in your functions palette, you will need to install toolkits (NI-Vision) and the drivers (including DAQmx) after installing LabVIEW 8.2.  This will populate the associated functions from Vision and DAQmx.
Carlton
CLA
0 Kudos
Message 6 of 14
(4,663 Views)
Hello again Carlton,

After reinstalling the drivers I now find the appropriate functions populating the functions menu, thanks to your advice. Now, I've incorporated all of the "RTSI with DAQmx (encoder-external scan clock continuous).vi" within my labview code, the only problem remaining is that whenever I try to run either the example or my own code I always end up with the error:

Error # -70125 occured at EnableAxis
Possible reasons:
Motion: -70125 (NIMC_wrongModeError)
The function was not executed because it was attempted at an illegal time.

I cannot make much sense of this myself - are you able to interpret what may be going wrong?

Many thanks for your excellent help thus far.

Ryan
0 Kudos
Message 7 of 14
(4,636 Views)
Hello!
 
I'm glad we're having success so far.  The most common cause for the error is the use of a function at an inappropriate time.  For example, are you using the Enable Axis function in the middle of another move or while the controller is in the middle of another process (move, initialization, home, etc)?  Be sure that any previously executed moves or processes have finished before you try to run that function.  Do you get this error if you run one of the examples without changing the block diagram?
Carlton
CLA
0 Kudos
Message 8 of 14
(4,629 Views)
Good afternoon Carlton,

It seems that somehow my "enable axis" function in the initialization section of my code was somehow producing this error - my guess is that one of the DAQmx functions used later on performs this function again? Anyway, with the enable axis vi gone the example now works, though I'm running into another error with the code about the limit input being active in the direction of travel once the  DAQmx  Start Tast vi is run. 

Ryan

edit: Problem solved, the channel name was off slightly from what it should have been - though now  I'm finding data acquisition  (and stepper motor speed quite slow),  could this be due to the extra "read position" function I included in the loop iteration?


Message Edited by FiberOptix on 11-06-2007 10:36 AM
0 Kudos
Message 9 of 14
(4,610 Views)
It seems that I just answered my own question again! The velocity is in different units from what I was using before and so I set it to a very slow speed without realizing it. Thanks again for your excellent help Carlton, I'm pleased to say that for this portion of the code everything is now working great!

Thanks again,

Ryan
0 Kudos
Message 10 of 14
(4,608 Views)