02-27-2007 03:36 PM
02-27-2007 04:48 PM - edited 02-27-2007 04:48 PM
Message Edited by Milqman on 02-27-2007 04:49 PM
02-27-2007 05:40 PM
02-27-2007 07:24 PM
02-28-2007 01:24 AM
Hi milqman,
Theoretically, it's possible to route the AI StartTrigger to a Counter task. Forgive me, I haven't read all your posts - hope this is "on-topic."
Cheers!
02-28-2007 08:20 AM
Yeah, I think there is a better way. Here are some comments, hints, suggestions, etc.
1. Counter measurement tasks cannot use the standard "Digital Start trigger." A similar behavior can be programmed using an "Arm Start trigger" which applies only to counters. You need to use a DAQmx Trigger property node to find this setting.
2. If this is still your engine measurement app with unidirectional motion, you may not need the Position measurement task at all. As long as you trigger off the Z-index, then the index into the array of AI and/or Freq samples tells you the corresponding position = (index/2000) * 360. You referred to this as "hokey", and I kinda see your point, but I think you'll find that the actual data you collect isn't really giving you more information. You're just gonna see angles incrementing by a constant fixed amount. Personally, I would use the "hokey" method and save the counter channel for another purpose (perhaps a delayed trigger?).
3. You still need to sequence the various calls to DAQmx Start to help keep your tasks in sync. More on this later.
4. Right now, 2 of your tasks are Started and Stopped in a loop. This would only make sense for certain types of triggered finite acquisitions. The trouble with finite acquisitions is that you are then committed to a certain "willful blindness" to what's going on between loop iterations. In some apps, this is just fine but in others, not so much.
The choice between finite and continuous really depends on the needs of your app. Finite acquisition is simpler to program because you can make a single call to read the entire buffer of data and DAQmx is smart enough to handle the waiting for you. Continuous acquisition gives you much more flexibility and allows you to accumulate long periods of gap-free data, but it requires smarter programming to repeatedly read smaller chunks of data from the buffer and feed it to your file and display.
5. Sequencing. I'm not at a LV PC to verify this, but here's an idea I *think* will work. I'm assuming that you've got an engine that's already running so the encoder A & B and index pulses are coming in continuously.
A. Configure the Freq measurement task to use the AISampleClock as its sample clock and the Z index pulse as an "Arm Start" trigger. The encoder's A channel will be the Start this task. Then feed the output error cluster to the input of the AI configuration vi's to enforce sequencing.
B. Configure the AI Pressure task to use the encoder's A channel as its sample clock and the Z index pulse as a Digital Start trigger. Now Start this task.
Result: You'll get buffers of synchronized freq and pressure measurements. The index into those buffers represents position, and a cumulative sum of 1/freq can give you a timestamp for each measurement as well.
Gotcha to watch for: the very first freq value can't be entirely trusted. The first Z-index pulse after starting the freq task will "arm" the counter and it will start counting time. It won't store a measurement of freq into the buffer until after the AI task has been started and triggered so it starts producing sample clocks. So there's a chance that the engine will go through 1 or more revs between the time you start the freq task and the time you start the AI task.
-Kevin P.
03-01-2007 11:50 AM
03-01-2007 01:43 PM
I've got only a minute or so now. There's probably a half dozen or so things that'd be simpler for me to "touch up" for you than to fully explain with words alone. Could you could post the actual code instead of a screenshot? Version 7.1 or 8.2 preferred. Hopefully you've got a version (probably LV Pro, maybe Full) that will let you do "graphical differencing" on the changes...
-Kevin P.
03-01-2007 01:58 PM - edited 03-01-2007 01:58 PM
Message Edited by Milqman on 03-01-2007 02:00 PM
03-07-2007 01:16 PM