10-23-2008 04:05 PM
I have 2 PCI-6254s in a linux box and I am trying to synchronize analog input data (ai0:1) with incoming digital data (port0). I feed a sample
clock to Dev1/PFI0. (I am currently just using the I/O of one of the installed boards) Somehow I can't line up the digital and analog data. I know this because I use the digital data to invert the polarity of the analog data yet the incoming digital data (printed from the buffer) doesn't correlate to what is happening to the sign of the analog data.
If I use the internal ai/sampleClock as the common terminal for analog and digital data the data looks fine and is repeatable.
thanks in advance for any suggestions.
Solved! Go to Solution.
10-24-2008 12:01 PM
Hi ant1,
Are you trying to sychronize the analog input from one card with the digital input of another card? I'm asking this because you should be able to this using a single card. Assuming that you are using DAQmx Base with LabVIEW on Linux, there is unfortunately no example on how to do a Multi-Function Synchronization on your board. However, I was able to find such an example in DAQmx. Although DAQmx Base only has a subset of functionalities available to DAQmx, you should be able to replicate this example. I have made small modifications to the code to remove any VIs you might not have in your DAQmx Base palette.
If following this example does not solve your problem, perhaps you can post a snapshot of your block diagram.
10-27-2008 03:01 PM
Hi S_Hong,
Unfortunately I am am not using Labview but just writing c code following the DAQmx ansi-c examples. You're diagram is
describes exactly what I am trying to do and I follow the same steps listed in the text under your diagram. I have found that
the SetTerminalName function won't work in my environment so I configure both digital and analog SampleClock to the same
device "/Dev1/PFI0".
Here is a snippet of my code:
/* Set up the analog input channel */
DAQmxErrChk (DAQmxCreateTask("",&AItaskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(AItaskHandle,"Dev1/ai0:1","",DAQmx_Val_Diff,-5.0,5.0,DAQmx_Val_Volts,NULL)); DAQmxErrChk (DAQmxCfgSampClkTiming(AItaskHandle,"/Dev1/PFI0",4000.0,DAQmx_Val_Falling,DAQmx_Val_ContSamps,4000));
DAQmxErrChk( DAQmxSetAIDataXferMech(AItaskHandle,"Dev1/ai0:1", DAQmx_Val_Interrupts));
/* set up the digital channel */
DAQmxErrChk (DAQmxCreateTask("",&DItaskHandle));
DAQmxErrChk (DAQmxCreateDIChan(DItaskHandle,"Dev1/port0/line0:31","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxCfgSampClkTiming(DItaskHandle,"/Dev1/PFI0",4000.0,DAQmx_Val_Falling,DAQmx_Val_ContSamps,4000));
DAQmxErrChk( DAQmxSetDIDataXferMech(DItaskHandle,"Dev1/port0", DAQmx_Val_Interrupts));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(AItaskHandle,DAQmx_Val_Acquired_Into_Buffer,4000,0,EveryNCallback,NULL));
DAQmxErrChk (DAQmxRegisterDoneEvent(AItaskHandle,0,DoneCallback,NULL));
The analog and digital data does not always line (are not synchronized). Do you see anything balatantly wrong?
Thanks for your response,
Ant1
10-28-2008 11:08 AM
10-28-2008 12:22 PM
Thank you reddog.
I followed your suggestions and my digital and analog data are now lined up
correctly.