Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ synchronous ai / ao

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

0 Kudos
Message 1 of 6
(3,870 Views)

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

Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
Message 2 of 6
(3,855 Views)

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

0 Kudos
Message 3 of 6
(3,845 Views)
So it seems that you do not want to measure in the middle of a clock cycle, but rather just during the waveforms period.  If you set your analog input sample rate to twice the frequency of the output and then you can even set a trigger delay of 1/4 the analog output waveform period by using the DAQmx Trigger property node with the Start»More»Delay.
Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 4 of 6
(3,823 Views)

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

0 Kudos
Message 5 of 6
(3,798 Views)

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.

 

1.png

This will produce an resources reserved error because you are creating two tasks that are trying to access the same timing engine.

 

2.png

This puts both analog output channels in the same task so that you do not encounter errors.

Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 6 of 6
(3,784 Views)