LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Link digital and analog signal?

Hi, I am trying to "link" a couple of analog signals to a dital signal.
 
I have a torque transducer with a integral quadrature encoder.  I am also monitoring a couple of other analog signals.
 
The 3 analog signals are being monitored through simultaneou sampling: 1Mhz for ~1sec
 
In these analog signals i am capturing certain events (peaks, etc).
 
What I would like to do is tie these events to the encoder which is tracking "angle" (rotational position).
 
 
For example, I determine that the peak torque occured at index 579,397 of the 1,000,000 element array.  What was the angle of the encoder at index 579,397 ????
 
 
I am using 7.1
 
 
Thanks for the help!
 
Ryan
Ryan

LV 7.1
0 Kudos
Message 1 of 20
(4,630 Views)
Ryan,

I'm a little unclear as to what is going on in your application. I do know, however, that it should be possible to perform a buffered counter acquisition (clocked by your analog input task) which will read the position of your quadrature encoder. Each position measurement will be correlated with a certain analog sample. Therefore, by knowing the index of the analog point in question, you could determine the position of the encoder at that moment. Does this sound like it will work with your application?

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 2 of 20
(4,614 Views)

That sounds to be what I am looking for.

 

A bit more info...I am monitoring torque on a rotating object (so 360 degrees of rotation...encoder gives me 360 rising edges per channel).  So the torque is an analog input.  I take 1,000,000 samples of the torque over 1 second.  I then break the 1,000,000 data points into 6 sub-arrays.  I then take the maximum torque value from each of these, so I have 6 torque values.  I need to be able to correspond each of these 6 torque values to where they occured during the rotation (for example 37 degrees, 1443 degrees, etc).

 

I have attached a rough sketch if that helps.  Also I forgot to mention I am using a PCI-6110

 

Thanks!

Ryan

LV 7.1
0 Kudos
Message 3 of 20
(4,610 Views)
Ryan,

Because we share the same name, I've created an example for you. Smiley Wink Basically,  we're using the analog input sample clock to latch the position of the encoder (connected to the counter). In a finite acquisition, the exact number of samples you request are generated on the sample clock. Since we are starting the counter task first, we'll be waiting on the analog input sample clock to start. This way, the two tasks will be exactly synchronized. Please let me know if you have any additional questions.

Good luck!
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 4 of 20
(4,596 Views)
Lol, Ryan is a good name isn't it??? Thanks for taking the time to help me out!

Ok, now lets get to it.  I had a chance to take a look at the code.  One thing that jumped out at me right away was a nice little error message asking me where "Get Terminal Name with Device Prefix.vi" was.


Surprisingly, I understood the rest of it except I have one question.  Is there a reason you chose to route the error in/out wires the way you did???  And also what is the "Get Terminal Name with Device Prefix.vi" for???


Thanks a ton for the help, I think this is exactly what I am looking for...I just need to get a bit clearer on a few aspects of it and then I am gonna give it a try!

Thanks,
Ryan

Message Edited by esa_paranoid on 11-07-2005 07:40 AM

Ryan

LV 7.1
0 Kudos
Message 5 of 20
(4,581 Views)
Ryan,

Glad to hear you were able to understand the code. Such is one of the many advantages of DAQmx. I did chose to wire the error clusters that way for a reason. The AI Voltage task timing must be configured before that clock is used in the counter task. Also, the counter task must be started (waiting on the clock) before the AI task is. If the AI task were started first, then the counter task may miss a few pulses of the sample clock, and your samples would not be synchronized. Finally, all the "Get Terminal Name with Device Prefix" VI does is elimate the need to specify the device number of the clock you are exporting (a headache if you have multiple cards in your machine). It just prepends the device number of the task you wire into it (whatever device you select on the front panel "Physical Channel" control). You can find this VI in several of the synchronization shipping examples (Multi-Function-Synch AI-AO.vi has it, for sure).

Good luck!!!
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 6 of 20
(4,572 Views)
Ryan - few questions have popped into my head as I try to code my project.
 
I have attached your vi with "my version" below your code.
The difference is I have 2 analog inputs I need to tie to the encoder - the issue comes into play near the "middle" of the code.  I do not know how to tie the "Get terminal name with device prefix" vi's to the clock for the encoder.  Take a look at it...you will see what I mean (i left the wiring out where I was unsure).
 
Thanks for the help!
 
Ryan
Ryan

LV 7.1
0 Kudos
Message 7 of 20
(4,553 Views)
Ryan,

How is it that you have 2 analog inputs? Do you have 2 boards? You can only have one analog input task per board. If these 2 channels are on the same board, then their DAQmx Create Channel VIs should be in series (adding the channels to the task one at a time). They would then share timing information. If you have 2 separate cards, then we run into a whole different set of issues. Please let me know.

Regards,

Message Edited by Ryan V on 11-07-2005 06:20 PM

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 8 of 20
(4,548 Views)
Ryan, no I only have one card - the PCI-6110 which is capable of simultaneous sampling (up to 4 analog inputs).  I am currently collecting the 2 analog samples at the same time, I will be adding the encoder.

I am not familiar with virtual channels however; I have been using MAX to setup my #samples/sampling rate/channels etc...
The virtual channel stuff in this example seems pretty straight forward though - we just need to figure out how to have 2 analog inputs and the encoder all linked together.

In MAX I have ONE task, but in the task I have TWO items being measured in the task...which results in simultaneous sampling of the two channels.  I am thinking we are close but need to figure out how to "join" the two virtual channels for the analog inputs???  Any ideas, am I making any sense?


Thanks,
Ryan
Ryan

LV 7.1
0 Kudos
Message 9 of 20
(4,544 Views)
Ryan,

The same logic that applies in MAX is used in LabVIEW. You only need one task, but you need to add multiple channels to it (either global (created in MAX) or local (created in LabVIEW)). I have attached a modified version of the previous VI. Notice the 2 DAQmx create channel VIs in series in the analog input task. This will add the Torque Transducer and Spark Voltage channels to your task, one at a time. Because you have an S Series card, they will be simultaneously sampled.

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 10 of 20
(4,526 Views)