Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set up start trigger for AI synchronize

Hi, I try to synchronize two PCI 6221 cards. One card used as master card. I used one DO channel to produce the sample clock I will use for both AI and AO channels. AI channels are on the master card. AO channels are on aother PCI 6221. I connected DO signal on the master card to PFI0 pin on slave card as the sample clock for AO channels on the slave card. Right now, I try to test if these two card really synchronize. I just give some output data to AO channel on slave card and use one wire to connect to AI channel on the master card. But the AI channel looks like it didn't read. With the same code, if I connect the AI channel to function generator instead of AO channel, the AI channel can read. I am not sure what is wrong here. In my code, I didn't use trigger for AI channel. Should I set start trigger for AI channel? But why AI channel can read when I connected to function generator directly? Thanks!
0 Kudos
Message 1 of 7
(3,315 Views)

Zhoulmnk,

 

It sounds like you are having a problem with the analog out, and it is not outputting the proper data. It would be best if we were able to see your code so I can diagnose this further and find out where the problem is. You can do a test with like a continuous acquire and graph - int clock on dev 1 (AI), and a test panel output on dev 2 (AO) to determine if you are actually sending the correct data as well as if you can read the correct data. This will take your code out of the equation so we decide if its the AO that is the problem or the code that is giving us the issue. You can also use the Multi-Function-Synch-AI-AO.vi from the example finder to use as the basis for you code, and then you can add the DO with the sample clock and have the PFI0 line pipe into a DAQmx timing property node called "Sample Clock -> Source" .  

Frank,
National Instruments
Software Group Manager
0 Kudos
Message 2 of 7
(3,294 Views)
Hi, I didn't use labview. I am using matlab to call DAQmx Function. My AO channel can send out the data correctly. I connect my channel on the oscilloscope and I also checked the same data feed into the AI channel. But the AI channel didn't read. Here is my code. I hope it will give you some idea about what I am doing. Thanks!
0 Kudos
Message 3 of 7
(3,287 Views)

Zhoulmnk,

 

I would ensure that the AO channel is properly outputting data before we try to synchronize the two devices. I would check the data output using a digitizer or scope to determine if the AO is actually putting out data. Also, when you say that the Analog In channel didn't read do you mean that there is an error, or you are reading zero values? 

 

Just a warning, when using .m code we cannot necessarily guarantee that our daq cards will function 100% as expected as we would see in Labview,  CVI , or .NET. The code is similar to C language code which we are able to provide examples for, but we do not guarantee that this will work as expected since they are using their own drivers to operate with .m code. Listed below is the tutorial for using NI-DAQmx in .m code. 

 

An Introduction to NI-DAQmx Tools for Data Acquisition with The Mathworks, Inc. MATLAB® Software

 

Frank L.

Frank,
National Instruments
Software Group Manager
0 Kudos
Message 4 of 7
(3,256 Views)
Hi Frank, I already figured out the problem. The problem is that I should start the counter task and the DO task first instead of start them after I start the AI task. Otherwise, the AO can send out data regularly but will wait until the AI channel time out. Thank you! liming
0 Kudos
Message 5 of 7
(3,245 Views)
I got new problem right now. After I use the same start trigger (external trigger) for AI channel(on master card) and AO channel(on slave card), the AI channel got 12ms delay. I fed the AO to AI. The AI start recording data after 12ms.I can not figure out the reason.
0 Kudos
Message 6 of 7
(3,234 Views)

This delay could be based on the amount of samples that you are reading. If for example you are reading at 10,000 Hz and are pulling 120 samples per iteration then the AI data would not come in until all 120 samples have been read for a total delay of 12ms after the data has been output on the AO channel. How are you measuring this 12 ms delay between the AO and AI? What device is taking in the trigger and what device is giving out the trigger?

Frank,
National Instruments
Software Group Manager
0 Kudos
Message 7 of 7
(3,210 Views)