NI Home > Community > NI Discussion Forums

Multifunction DAQ

Showing results for 
Search instead for 
Do you mean 
Reply
Member
artaxerxes
Posts: 21
0 Kudos

Multifunction Synch AO AI Same Clock - restart AO? From different postion in the buffer?

I have been adapting an example VI to examine sync'ed AI/AO.  Adapted example is included.  This example will be transformed into a Matlab MEX using the Math Interface Toolkit, hence the format of the input and output arrays.  Currently the VI creates a waveform and chucks this out AO, whilst looping over AI.

 

As my aim is synchronised AI and AO. We (as advised) fire the AO before looping the AI to ensure sync.

 

As the AO buffer is depleted my hope is to re-address it based on some interaction with the AO.  By re-addressing I hope to be able to continue AO from any arbitary point in the AO buffer within that final loop.  Alas, I am an utter neophyte at LABVIEW haven't wasted my formative years in MATLAB.

 

 

Member
Tony_G
Posts: 45

Re: Multifunction Synch AO AI Same Clock - restart AO? From different postion in the buffer?

Hi Artaxerxes,

 

Currently you start a continuous generation of a waveform before you acquire the analogue input later in the while loop.  From your question, I think you want to be able to stop and start the waveform generation at any point while still acquiring the analogue input.  Please find the following VI, where I have added two case statements in the while loop.  One case statement stops the waveform generation, the other starts it again and both still use the original reference.  I have placed two latched buttons on the front panel for you to control when to stop and start the waveform generation.

 

 

 

Please let me know how you get on.

 

Best regards,

 

Tony_G

Member
artaxerxes
Posts: 21

Re: Multifunction Synch AO AI Same Clock - restart AO? From different postion in the buffer?

Hey, 

 

thanks all, we have been working on this off and on for the past couple of months.  I am enclosing our current work so that all can benefit from same synch AI AO on USB NI devices.

 

I still have a way to go with the more mundane elements of the code,,, but synched AI AO on a USB 6229 is here.

 

Note the large buffer assigned!

Member
artaxerxes
Posts: 21
0 Kudos

Re: Multifunction Synch AO AI Same Clock - restart AO? From different postion in the buffer?

Just adding a note - that the above posted VI allows a buffer to be sent to the AO to be switched live based on the AI.
Member
trouinky
Posts: 73
0 Kudos

Re: Multifunction Synch AO AI Same Clock - restart AO? From different postion in the buffer?

This is what I've been looking for (synchronizing a buffered read with a buffered write). Think "I vs. V curve" and that's the idea. Scan +/- voltage range repeatedly while reading voltage (converted from current via transimpedance amp).

 

What I'm running into is that the write and read are not on the same device. I have a PCI-based AO card (PCI-6731) and a USB AI card (USB-6210). The setup requires control from 4 Analog signals, otherwise I'd run everything from the 6210...

 

How do I sync the two, considering using the /Dev#/ai/SampleClock generates an error (there is no digital edge to detect between the devices, or something to that effect). Could I use a trigger out on the PCI card into perhaps a counter input on the USB device to trigger the read when the write starts (or something to that effect)??

 

Thanks in advance.

 

Tommy.R

><><><><><><
Tommy R.
><><><><><><
Active Participant
Mcdan
Posts: 480
0 Kudos

Re: Multifunction Synch AO AI Same Clock - restart AO? From different position in the buffer?

Tommy,

 

You'll want to export the sample clock from your AI Task (see DAQmx Export Signal.vi) to a PFI line on your 6210 (PFI 4-7 should work for output).  Wire this line to a PFI 5 on your 6731.  Then, on your analog output task, set the start trigger source to /6731DeviceName/PFI5.

 

In this way, you are providing a path to get the sample clock from the 6210 to your 6731, and configuring the 6731 to use this signal as a sample clock.

 

Hope that helps,

Dan

Member
trouinky
Posts: 73
0 Kudos

Re: Multifunction Synch AO AI Same Clock - restart AO? From different position in the buffer?

I've been trying to get something like this to work. I knew I could internally remap one of the digital lines to act like a trigger line. Thanks for the input.

><><><><><><
Tommy R.
><><><><><><
Member
trouinky
Posts: 73
0 Kudos

Re: Multifunction Synch AO AI Same Clock - restart AO? From different position in the buffer?

Is the start trigger source set on a DAQmx trigger node for the AO task (Start.DigEdge.Src perhaps?), or at the source terminal for the DAQ Timing VI? I figured the latter is for an externally controlled timing clock...

><><><><><><
Tommy R.
><><><><><><
Active Participant
Mcdan
Posts: 480
0 Kudos

Re: Multifunction Synch AO AI Same Clock - restart AO? From different position in the buffer?

[ Edited ]

Tommy,

 

You've got that correct.  The start trigger source is configured through the DAQmx Trigger property node, and the sample clock source is configured with the DAQmx Timing VI (or DAQmx Timing property node).  In glancing at the VI attached to an earlier post, the sample clock from one task is being used as both the start trigger and sample clock for the 2nd task.  Once you have your 6210 exporting it's sample clock, and have that wired to one of your 6731's PFI lines, you should be able to use that line as either a sample clock, or a start trigger (or both) depending on your needs.

 

Hope that helps,

Dan

 

 

Member
trouinky
Posts: 73
0 Kudos

Re: Multifunction Synch AO AI Same Clock - restart AO? From different position in the buffer?

Using the AI sample clock to control it all won't work for me (I want 10 data points for every AO data point). I'm working on finding the correct property node on the AO task line to assign the digital pulse from the start of the AI read as the trigger for the start of the AO write.

 

{Crossing fingers...}

><><><><><><
Tommy R.
><><><><><><