Jump to content

Counter Sync Sanity Check


ASTDan

Recommended Posts

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

post-8614-1221053094.gif?width=400

Link to comment

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.

Link to comment

QUOTE (Kevin P @ Sep 10 2008, 12:18 PM)

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

Link to comment

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

Link to comment

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.