Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing a digital output with a analog input

Hi,

 

I'm using a SCXI-1000DC with a SCXI-1600, a SCXI-1531 and a SCXI-1163 to receive an analog signal from an accelerometer and send a digital signal.
I have two "while" loops to constantly monitor each one of the signals. With the program like this, I don't have the two signals sincronized, and I need it, to in the end have a waveform graphic with the two signals.
Can this be done in software? I analised some trigger examples, but I don't understand them at all!
I'm using a 25k rate and a 12,5K samples per channel on DAQmx Timing.

 

I hope you can help me.

 

Thanks
Silvia

0 Kudos
Message 1 of 8
(3,817 Views)

You can sync them on the hardware level when you use the same refernece clock (ai:ReferenceClock). You can set this for the DO using a DAQmx timing property node.

However instead of wrinting 1 sample to the AO, you need to write the same number of samples as you read in the ai loop. (not sure about this, propably it also works with different number of samples, but 1 would be too slow).

See here for some examples:

http://zone.ni.com/devzone/cda/tut/p/id/3615

Fig 5 shows the shared reference clock.

You do not need a start trigger, as the reference clock will start running once you start the ai task (just start the do task before).

 

Felix

0 Kudos
Message 2 of 8
(3,805 Views)

Hi Felix,

 

First of all, thanks for your help.
I made some changes in the program, but I still have some doubt.
How can I put the same number of samples of an analog input in a digital output? Is this possible?
Another thing, this error appear when I stop the program, "Error -200077 occurred at Property Node DAQmx Timing (arg 1) in DAQmx Timing (Sample Clock).vi". It seams that digital output don't like sample clock!

 

Thanks
Silvia

0 Kudos
Message 3 of 8
(3,787 Views)

How can I put the same number of samples of an analog input in a digital output? Is this possible?

 

Just use the Initialize Array prim with the 'samples' terminal as input and get an array of appropiate size with all values T or F.

 

About the error, I'm not familiar with your device. You need to check that your DO is capable of digital waveforms. If it is an PFI channel, it's possible that it's only capable of static DO. Do you have a diffrent chanell available that isn't PFI?

 

Felix

 

 

0 Kudos
Message 4 of 8
(3,779 Views)

Hi,

 

I think it's only capable of static DO, because it said that should be "On demand" in the error.

Another thing, it's possible to have the waveform in order to the time, instead of the number of samples?

 

Thanks

Silvia

0 Kudos
Message 5 of 8
(3,740 Views)

Hello Sreis,

 

What device do you use to comunicate with SCXI.

Task synchronization between your analog and digital is done by your communication card. Some cards do not support the generation of digital pattern, but simply on request "("on demand").
It appears that your card can not do digital pattern generation, I invite you to check if your card allows for the buffered digital generation.

 

Best regards,

0 Kudos
Message 6 of 8
(3,738 Views)