ASTDan Posted September 11, 2008 Report Share Posted September 11, 2008 Hello, I was wondering if I could get a sanity check from the great minds of LAVA I am using a NI 9237 and a NI 9411 in a CDAQ chassis. I would like to syncronize the counter pulses with the analog input. Since I am using a 9237 I can't set the counter pulse as the clock for the analog input due to it is a Sigma Delta C seris module (see the 9172 Manual). So I set the clock on the counter to be the ai sample clock. I plan to remove the duplicate values from my counter array and analog input array giving me analog input measurements lined up with my counter pulse. Here is my code. It seems to work great. I just want another set of eyeballs to say "that will work" or "what the h%$# did you do!!" Excuse the messy code. I will clean it up when I finalize the prototype. Thanks Quote Link to comment
Kevin P Posted September 11, 2008 Report Share Posted September 11, 2008 I've never used cDAQ devices, but based on knowledge of sync'ing tasks across PCI boards and such it looks very reasonable. Really only 2 minor comments: 1. I don't "get" the use of an internal 20 MHz clock as a trigger. Not clear to me what it buys you. But maybe that's a cDAQ thing... 2. If you ever request an AI sample rate that can't be generated exactly by your cDAQ device, I'm not sure if your property node query will work correctly when you query before reserving / committing / starting the task. I had a past experience where a similar query returned the exact same value I requested if I queried it before starting the task, but returned the true physically possible nearby value if I queried after starting the task. That was many versions of DAQmx ago though, so not sure if still relevant. Try putting in a task control vi after the trigger config and before the start. Set it to reserve or commit the task. Do a second query of the SampClkRate here. Then do a 3rd query after the start. See if the 3 show any discrepancies as you try various not-quite-possible AI sample rates. -Kevin P. Quote Link to comment
ASTDan Posted September 11, 2008 Author Report Share Posted September 11, 2008 QUOTE (Kevin P @ Sep 10 2008, 12:18 PM) 1. I don't "get" the use of an internal 20 MHz clock as a trigger. Not clear to me what it buys you. But maybe that's a cDAQ thing... I want to start the analog and counter acquisition at the same time. Using the internal clock I don't need an external connection. QUOTE (Kevin P @ Sep 10 2008, 12:18 PM) 2. If you ever request an AI sample rate that can't be generated exactly by your cDAQ device, I'm not sure if your property node query will work correctly when you query before reserving / committing / starting the task. I had a past experience where a similar query returned the exact same value I requested if I queried it before starting the task, but returned the true physically possible nearby value if I queried after starting the task. That was many versions of DAQmx ago though, so not sure if still relevant. Try putting in a task control vi after the trigger config and before the start. Set it to reserve or commit the task. Do a second query of the SampClkRate here. Then do a 3rd query after the start. See if the 3 show any discrepancies as you try various not-quite-possible AI sample rates. Yes in that diagram it is imposible to set the sample rate of the 9237 to 1kHz, the lowest is 1.6 kHz. That is why I ask to see what the sample rate is actually set at to get both tasks sampling at the same rate. You make a very good point. I will experiment with quering the sample rate before and after setting the task. Thanks Dan Quote Link to comment
LAVA 1.0 Content Posted September 12, 2008 Report Share Posted September 12, 2008 Hi Dan, If I look at your program, here's what I would do (in text). Use the AI-clock as the clock of your counter. You don't need a start trigger for the AI task, via the AI-clock both tasks are synched. First start the counter task, second start your AI task (in the way you want) because both tasks use the same clock and the counter task is started first this enforces synchronized start. Ton Quote Link to comment
ASTDan Posted September 12, 2008 Author Report Share Posted September 12, 2008 QUOTE (Ton @ Sep 11 2008, 01:53 AM) Use the AI-clock as the clock of your counter.You don't need a start trigger for the AI task, via the AI-clock both tasks are synched. First start the counter task, second start your AI task (in the way you want) because both tasks use the same clock and the counter task is started first this enforces synchronized start. Thanks for the sugestion. I will get rid of the trigger. Thanks for giving me a sanity check. The walls of my office don't offer any good advice. Dan Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.