LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronous AI, AO and DI

Hello LabVIEW community - I am have some difficulty in getting my application to work properly - specifically monitoring the status of a DI line during AI and generating an AO waveform.

 

The equipment I am using consists of:

  • cDAQ 9172 chassis,
  • 9401 DIO module (slot 5),
  • 9239 AI module (slot 6),
  • 9263 AO module (slot 3) and,
  • 9481 Relay module (slot 2).
 

What I’m trying to accomplish is the following:

  • Measure three AI channels on the 9239
  • Generate a single channel AO waveform on the 9263
  • Monitor the status of line 2 on the 9401

 

I have the AI and the AO parts working well.  I have one task to measure the three AI channels and one task to generate the AO using a waveform (operating at the same frequency as the AI which is 1613 Hz).  Both tasks are started by a trigger from line 0 of the 9401 (via the /DIO/PFI0 which is why the 9401 is in slot 5).  This part works great because the AO and AI start at the same time and everything works in perfect concert.

 

What I am having difficulty with is trying set set up a task to monitor the input on line 2 of the 9401 during the AI and AO operations.  I need to know when the line goes high in relationship with the AI and AO data.  The DI tells me when a set of contacts on an external relay are closed and I want to know the timing of this event in relationship the the AI measurements.  I tried to create a task to read the line status in a similar fashion the the AI task (same sampling frequency same starting trigger, etc.) but I get an error saying this is not supported because the 9401 is not in slot 1-4 where its input can be buffered.  If I move it there then I lose my ability to trigger the AI and AO tasks using the DI line 0 input.

 

I can read the status of DI line 2 by putting a single read task inside the same "Do While" loop wherein I read and chart the AI data but I can't do this with certainty of the timing of the DI read in relationship to the timing of the AI and AO operations. 

Any ideas on how to get all three things accomplished more or less simultaneously?

 

0 Kudos
Message 1 of 4
(2,882 Views)

If you can stand the wastage of data space, then consider measuring the relay contacts with another analog channel.

You can search thru the data and find where the transition occurs, and have the exact sample number.

(Not that exactness is all that practical with mechanical relays...). 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 4
(2,878 Views)

Hi Steve - thanks for the suggestion.  I was doing this initially then I had a need for the fourth AI channel for another feature withing the VI so I was hoping to utilize an open DI line instead of purchasing another AI module.

 

Any other suggestions?

0 Kudos
Message 3 of 4
(2,867 Views)

I'm not sure about your particular hardware, but I have a case where I use the exact same clock signal to drive the AO port as what drives the AI acquisition.

 

I have to tell the AO task to get its clock from the AI SCAN CLOCK, but that's a simple VI call at configure time, and it's all automatic from there.

 

If you're running a timed DI task, then consider doing something similar - use a DAQ MX TIMING property node and set the SAMPLE CLOCK to your AI SAMPLE CLOCK source.

 

Then your digital data should occur exactly in sync with your analog data.  You'll still have to search thru it, but a 1D SEARCH ARRAY ought to handle that for you. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 4
(2,861 Views)