11-09-2009 09:31 PM
Hi,
I'm having a catastrophically frustrating problem building a vi to control an analogue output (voltage) and an analogue input (currents). The issue is that the input needs to be synched off the output -- I need to take one measurement while the ao is high and one while the ao is low each cycle, but I can't figure out how to synchronize these correctly (I also have to keep these measurements seperate for processing). I'vesearched through all of the examples, but none illustrates how this could be done [clearly enough for me to understand].
I haven't been able to figure out how to make the daq wizard build this kind of vi, and I am really having a hard time with the standard daq vi's - they're unlike anything I've seen in labview thus far.
I have the compactDAQ into bundle with
cDAQ 9172 chassis
NI 9219 analogue input module
NI 9264 analogue output module
Thanks for any help,
-mpc
11-10-2009 05:55 PM
The example program Multi-Function-Synch AI-AO.vi in the example finder under Hardware Input and Output»DAQmx»Synchronization»Multi-Function is pretty much exactly what you want. Because the timing for both the Analog Input engine and the Analog Output engine is coming off the cDAQ chassis it is referenced to the same timebase. All you need to do is specify the rate you desire and make sure the tasks share the same start trigger.
http://zone.ni.com/devzone/cda/tut/p/id/4322#toc4 for more information.
Do you have any experience with DAQmx low level programming? If not I would recommend you check out the following Getting Started with DAQmx Programming:
http://zone.ni.com/devzone/cda/tut/p/id/5468
11-11-2009 12:18 PM
Hi Doug,
Fanstastic response -- thanks for the quick reply.
The link you gave is great - for some reason I hadn't found it before. I have one more question though:
What I would like to do is to set the voltage out at some frequency, and then read the current in at the ~middle of that clock cycle (so I get a measurement when the voltage is on and when it is off -- i'm basically building a lock-in amplifier). How do I sync the two modules together, but work the analog input at small delay?
The synchronization i need is illustrated below:
111000111000111000 Voltage out
010010010010010010 Current in
any thoughts?
Thanks again for your help,
-MPC
11-12-2009 03:15 PM
11-16-2009 02:26 PM
Hi,
Okay -- that makes sense. I could probably get that going with enough effort.
I have a new problem, though. I'm trying to output two voltages at the very beginning - the drive voltage that we've already discussed, and a DC voltage out (that I use to drive a photo-transister that I will be measuring the analog in from). I can't find a way to set up both voltage out's without some sort of resource violation. Any suggestions?
Thanks,
-MPC
11-17-2009 12:53 PM
Hey,
So for analog output and tasks on one board there is only one timing engine. When you create an analog output task and start it that timing engine become reserved. What you need to do is to just include both channels into one analog output task.
This will produce an resources reserved error because you are creating two tasks that are trying to access the same timing engine.
This puts both analog output channels in the same task so that you do not encounter errors.