11-08-2006 05:53 AM
11-09-2006 10:11 AM
An M-series board can already do the digital change detection you want -- no need for external hardware. The lower-cost M-series boards provide only an 8-bit port for hardware-timed DIO, so you'll need to bump up to one of the ones with a 32-bit hw-timed port.
When you perform a change-detection based acquisition on your DIO, there's an internal signal with a name like "ChangeDetect Pulse" which can be used as a sampling clock for other tasks.
The problem I see is your desire to sample position on each analog sample & on each digital change, while also timestamping each degree pulse (presumably for speed variation measurements?). That would sorta imply using 3 counters but the M-series boards provide only 2. The simplest-looking workaround would be an external circuit to OR the analog startscan pulse with the digital change detect pulse (assuming it can be routed out to an external pin -- it probably can). But I think you'll end up with some timing issues there where the two pulses might overlap such that two overlapping input pulses only lead to 1 extra-long output sampling pulse. That'll cause your data to get out of sync.
Let's break this down:
1. To store correlated valve state and engine position, you'll do change detection on 10 digital inputs. On each transition, you'll sample your 10 valve states. You'll also have a counter task counting encoder pulses that'll be sampled on each change detect pulse. This gives you correlation between valves and position.
2. You can then set up a constant-rate analog task. You'd also have another counter task counting encoder pulses that'll be sampled on each analog sample clock. This gives you correlation between your gas sensors and position. It will also give you some engine speed information. The position difference over a constant sample interval would be the average engine speed for that interval.
3. (alternative to #2) If it's more important to timestamp individual encoder edges to give you more precision in your speed measurement, then you can set up your second counter as your described. You would then need to use the encoder pulses to drive your analog sampling. The simplest is to sample on each encoder edge. It should also be possible to divide the encoder pulsetrain down by any integer >= 4; this would give you fewer analog samples than position timestamps. This type of scheme will give you analog samples at specific engine positions rather than at specific time intervals.
4. For any scheme, you'll need to plan on sync'ing the acquisition start times, probably to some specific 1-per-rev signal like one of the valves. The analog and digital tasks would call this a Digital Start Trigger using the standard DAQmx Trigger vi. The counter input task needs to configure that signal as a digital "Arm Start" trigger, which is only available through the DAQmx Trigger property node.
It looks like there are a few tradeoffs to make in order to do this with a single board, but it seems you can probably get there in the end. It appears to me that the 6224 is the cheapest plugin board with >8 bits hw-timed DIO, but you should talk to your NI rep to be sure.
-Kevin P.
11-09-2006 12:58 PM