georgekm Posted June 7, 2008 Report Share Posted June 7, 2008 Is there a way to read both digital and analog signals in the same VI? I have an encoder line that is used as a trigger for aquiring data from an analog input. But I also want to be able to plot the encoder signal. Is there some way to do this? Thx Quote Link to comment
jgcode Posted June 7, 2008 Report Share Posted June 7, 2008 Definately can be done in DAQmx using the DAQmx APIs. Can't confirm NI-DAQ. Which drivers are you using? Quote Link to comment
BrokenArrow Posted June 7, 2008 Report Share Posted June 7, 2008 QUOTE (georgekm @ Jun 6 2008, 11:05 AM) Is there a way to read both digital and analog signals in the same VI? I have an encoder line that is used as a trigger for aquiring data from an analog input. But I also want to be able to plot the encoder signal. Is there some way to do this?Thx I'm not sure what you mean by "...in the same VI". Do you mean, in one VI? For example (and to jgcode's point), using DAQmx, you can make one Multi-Function VI that does ALL of your Digital & Analog reads and writes. Of course, this one VI will contain several polymorphic sub VI's, but these ship with LabVIEW, your one VI (i.e. same VI) just makes calls to the other VI's. Do you need an example? We also need to know what interface (driver) you are using: DAQmx, NI-DAQ (i.e. Traditional DAQ), or third party. Richard Quote Link to comment
jdunham Posted June 7, 2008 Report Share Posted June 7, 2008 QUOTE (georgekm @ Jun 6 2008, 08:05 AM) Is there a way to read both digital and analog signals in the same VI? I have an encoder line that is used as a trigger for aquiring data from an analog input. But I also want to be able to plot the encoder signal. Is there some way to do this? (Assuming you are using DAQmx) Generally a timing/trigger line is not digitized and stored, as far as I know. The easiest thing is to just run the trigger line to an unused analog channel so that it's easy to plot. Of course you will likely see a one-sample delay in the digital plot, because you won't start sampling until after the line goes high (assuming a typical trigger configuration). You can also wire the encoder line into a counter input and do a buffered counter operation at the same rate as the analog input. You will want to set the counter task to start and clock with the analog input scan clock, and make sure it starts and is armed before your analog operation starts. You should be able to find some DAQmx examples for syncrhonized tasks. You will still have to call separate functions to get the analog data versus the digital data, and you will want to set the DAQmx.Read properties of the slave task so that you know you are reading the same samples as from the master task. See http://forums.lavag.org/Independent-A-D-sampling-is-it-possible-t10987.html&p=46138#' target="_blank">this post for DAQmx Read properties. Quote Link to comment
georgekm Posted June 12, 2008 Author Report Share Posted June 12, 2008 Thx guys, I figured out the mistake I was making. I had two DAQmx read VIs trying to access the same channel at the same time. I've now wired the error out from one read vi to the next one so that the two activities are performed one after the other. ge Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.