Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing of DO and AO with USB-6259

Solved!
Go to solution

Synchronisation.PNG

 

Hallo everyone,

 

i use right now the device USB-6259, and wanna synchronize AO with DO. I connected the Ctr0-Sample-Clock with the Timing-Funktion of AO.

My task is: DO with 1MHz, and AO with 1KHz, and both synchronized.

Problem is: i just can use the same rate for AO and DO, because when i change the rate of AO, what i wanna output is changed.

Question: can i use the same sample clock and diff. sample rate? or i shloud my VI change?

 

Thanks for answer,

Best Wishes

0 Kudos
Message 1 of 12
(4,298 Views)

OK, it works, i just set it as timebase

: )

0 Kudos
Message 2 of 12
(4,291 Views)

Can you post again with the working version of code -- it may help others who find this thread in the future.

 

Note: Because you're using the counter task to generate the timing clock for DO and AO (probably as a direct sample clock and a sample clock timebase respectively), you have a kind of master-slave arrangement among your tasks with the counter as master.  

   In such cases, you'll get more reliable sync by making sure you start the master counter pulse train task *last*.  That'll drive sync at the hardware clock level.  Right now you have pretty close sync based on software sequencing, but the small offset between start times for AO and DO may vary a little bit from run to run.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 12
(4,270 Views)

thanks for your refer.

when my Programm works perfect, i will do it. 🙂

you are right, i am trying to set a start-Trigger.

small question: which start-trigger of the Counter is better to route? xD

 

0 Kudos
Message 4 of 12
(4,268 Views)

maybe the Counter start later than AO and DO(sequ.loop),and need not the start-trigger

0 Kudos
Message 5 of 12
(4,263 Views)

I'm not sure you'll need a start trigger.  (More advanced discussion below*.)  Just use the counter pulse train to set up timing for both AO and DO, and then be sure to start the counter task *last*.

 

In the screenshot you posted, 3 sequence frames are visible.  You should start AO and DO in the 1st visible frame, and then start the CO pulse train in the 2nd frame.  That'll make sure that AO and DO sampling are sync'ed at the hardware level of timing.

 

*Advanced discussion:

   Let's assume a 1 MHz pulse train, DO configured to use the counter output directly as its sample clock, AO configured to use the counter output as its sample clock timebase source.  You would further set a timebase divisor of 1000 to divide down from 1 MHz to 1 kHz.  (Both of these would be configured with a DAQmx Timing property node.)

   I *think*, but am not certain, that the first AO sample will happen after the 500th counter pulse.  You'll have 1 AO sample per 1000 DO samples and it will update right in the middle of that set of 1000.

   One strategy to make the 1st AO sample occur simultaneous with the 1st DO sample is to prepend 500 default DO values at the beginning of the set of data you actually care about.  That'll line up the 1st AO sample with the 1st *real* DO sample.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 6 of 12
(4,258 Views)

Hello Kevin,

 

i tried to use a Trigger-property to set a delay of DO. But i just got a error, said, my device does not support this funktion.

does 6259 not Support strart-Trigger for DO?  where can i find the White paper, which supports my device.

what the Manual said, is not enough. 😞

Thank you for your help 🙂

 

best wishes

0 Kudos
Message 7 of 12
(4,247 Views)

1.  I'm pretty sure your device will support a Start Trigger for DO, but am not so sure whether it supports the trigger delay property.  It's possible you're getting that error because you need to call DAQmx Trigger to enable triggering for the task before you try modifying trigger parameters with the DAQmx Trigger property node.

 

2.  Back in msg #2, it sounded like you were on the right track by using the counter output as a *timebase* that the AO task could use to *derive* a slower sample clock.  The latest code shows no AO whatsoever, so it's unclear how close you actually got.

 

3. Your task start sequencing is still the opposite of what I advised.  You're starting the CO task before configuring and starting DO.  You should be starting CO *last*.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 8 of 12
(4,239 Views)

Thank you for your reply.

i post 2 VIs. Thet work good, but just a little problem:

1. (1st VI) in the master device, i tried to synchronize the DO+AO+CO, so i used the ctr0-SampleClock as the Timebasis, and divided for AO. But there was a delay, DO output always before the AO with 1 Clock(Takt) of DO(Figure 1), so i added one logi.0 befor my dates(figure 2). That looks like synchronized 🙂 I guess, maybe it is the problem of the start-trigger, i am not sure right now, and testing.
2. (2nd VI) When i wanna synchronize the 3 devices and QM as Master(namely i route Ctr0-SampleClock with export-bolck to PFI0,and just also use the ao-start-trigger for 3 devices), also a problem, slave later with 1 Clock than the master(Figure 3).
So all of them i guess, maybe the problem is by "divided" and "delay of the start-trigger"??? (testing now)
I am pretty happy i can discuss with you( although always i ask you answer :p), and thank you for your reply and idea again.

best wishes

Synchronisation of DO+AO in Master DeviceSynchronisation of DO+AO in Master DeviceFront of MasterFront of MasterSynchronisation of Master+SlaveSynchronisation of Master+Slave 

0 Kudos
Message 9 of 12
(4,235 Views)

1. Just to set expectations: I don't follow all the details of your code, your intentions, which signals map to which scope traces, different single-board and multi-board configurations, etc.   I only have time to address specific focused issues.

 

2. I *think* the main issue is that you want the 1st DO sample and the 1st AO sample to be generated at the same instant.  Back in msg #6, I mentioned the likelihood that dividing down the master timebase would likely result in an offset of about 0.5 millisec (500 samples of the 1 MHz DO task).  

 

3. I also (very briefly) mentioned a simple way to address it.  Just prepend 500 "fake" DO samples to the beginning of the real data.  Set those fake DO samples to output the same digital state that is on the output pins when you power up and the task is idle.  If the pins idle in low state, start your DO task with a sequence of 500 low states. 

   To test this, make sure the 501st DO sample (the 1st real one) makes a transition to the other digital state, similarly making sure that the 1st AO sample shows a step change.  You can capture the signals on your scope, and then if need be, adjust the # of "fake" DO samples until you align the 1st AO sample with the 1st real DO sample.

 

4. It's also possible you might be able to set up the DO task with a trigger and a post-trigger delay as an alternative.   But I think the extra 500 sample method will be easier to set up and troubleshoot.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 10 of 12
(4,229 Views)