Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

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

The plot thickens!!! I think I can help you with this, however I want to make sure that I understand exactly what you are trying to do.

 

Please let me know if I have this correct:

You are outputting a waveform on your 6731. For each sample output, you would like to read 10 samples from your 6210.  Is that a fair summary of what you're attempting to accomplish?  How fast are you updating your output?

 

If I understand what you're attempting to do correctly, I'll see if I can whip together an example to help guide you.

 

Dan

0 Kudos
Message 11 of 31
(1,079 Views)

I am successful already with really slow rates (<100 samples/second written) with great results, but at about 200 samples/sec, I get what looks like a smearing in the data which is a timing issue I know, but can't solve.... the read is starting before the write just enough . . . or vice versa.

 

I ramp 0-10 Volts (1000 steps) at some rate (100 to start is good, but eventually faster, hence the need for tight timing). This ouput is a simple ramp (10-0 / 1000 = dV, 0.001 V steps). At the end of this scan, I reverse the array and ramp back down to 0 at the same rate.

 

The read is done while the 0-x Volts is written. If I can read at 10x the write, I get to take 10 samples at each voltage and average (MUCH better overall signal, proven even at the slower speed).

 

I have what amounts to a 1000x1000 grid. Originally someone in the lab programmed timing in a nested loop... at 20-30 ms for each measurement, they were wondering why a 1000x1000 scan was taking 17 hours! Duh. Doing the scan in hardware is much faster and getting this timing thing down will perfect my new technique. Hopefully a < 2 - 3 minute scan over my sample.

 

Here's a much simplified version of what I'm trying to get going, but don't know if the property node is the right one....

 

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 12 of 31
(1,076 Views)

Tommy,

 

I've attached my idea on how I'd do this.  I use the 6210's sample clock as the 6731's sample clock timebase (basically the signal which is divided down to create the 6731's update pulse).  I set the 6731 to use a timebase divisor of 10, to issue a sample clock for every 10 sample clocks from the 6210.  This will ensure that the two devices remain synchronized, and allows the AO sample clock to be generated as a multiple number of AI sample clocks.  I've added some comments to the block diagram which hopefully will clarify what I've done.

 

Hope that helps,

Dan

 

Edit: I don't have the actual hardware handy to test this with, so appologies if it doesn't work right out of the box.

Message 13 of 31
(1,073 Views)

Makes a lot of sense.

 

My technique's not working, the read happens, but no write, so the trigger isn't working... yet. Need to put a scope to see if the trigger pulse is showing up on the right port.

 

Let me play...

 

Thanks so much for your input.

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 14 of 31
(1,069 Views)

Just when you think you're getting close to knowing it all, you get schooled.....

 

Fabulous, clear as a bell. I'll drop this in after testing my previous. Even if that works, this is more elegant and precise I'm sure.

 

I'm trying to do a full scan and post process the data, so not 10 at a time, process, 10 at a time, etc., but a full 10000, then offload the data in a queue to process....

 

Gotta run for now, but I'll be back at it in the am, hopefully with good news.

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 15 of 31
(1,064 Views)

I'm pretty sure I had a bug in my first example... Because I did not explicitly set the delay from start trigger to sample clock on the AO task, I believe that the first AO sample clock would occur two AI sample clocks after I began AI rather than 10 as I intended.  I've fixed that in this version, plus simplified the logic for DAQmx read.  It sounds like you have a good handle with what to do with your data once acquired, so feel free to ignore that part of my code.

 

Hope that helps,

Dan

0 Kudos
Message 16 of 31
(1,060 Views)

Doh!

 

Ignore the last version... I set my start delay with the wrong units.  The attached version should work better.

 

Dan

0 Kudos
Message 17 of 31
(1,055 Views)

Didn't have much time to test it today, but I did hook up a scope to confirm the timing pulse train output routed to PFI4 for the 6210 (learned that 0-3 are inputs and 4-7 are outputs), but I never get any data at the end of the scan.

 

Tomorrow I'll scope the AO channel at the same time to make sure it's writing the ramp and go from there. I have a sneaky suspicion that the PFI0 on the BNC box is not getting the pulse to start the write....

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 18 of 31
(1,047 Views)

I've used all PFI's on the 6731 and I continue to get error -200560 at the wait until finished VI (acting like the write never gets started). Do the PFI channels need to be preset as Input or Output on that device? I can't find it in MAX if so (I know that some digital ports need to be assigned a particular configuration). The sample pulse train from the 6210 is showing up at PFI4 correctly (and was wired into each PFI on the 6731 as I tested) and correctly changes as a change the sample frequency... The 6731 is connected to a BNC breakout box, so maybe this has some configuration that I'm missing???

 

I'm going to work on a simple pulse from the 6210 to kickstart the 6731....

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 19 of 31
(1,037 Views)

Tommy,

 

There shouldn't be any extra logic required to set the PFI line to input.  A simple way to test whether the 6731 is seeing signals over PFI would be to run the 6731's counter test panel in Measurement and Automation Explorer (MAX), select 'Edge Counting' as the mode, and the PFI terminal you have wired with the 6210's sample clock output terminal to as 'Edge Source'.  If you don't see the 'Counter Value' increasing when you run the 6210's AI, then we need to determine why.

 

One thing that's usually worth checking is to ensure there aren't any bent pins on the BNC breakout box.

 

Hope that helps,

Dan

0 Kudos
Message 20 of 31
(1,034 Views)