10-14-2005 12:15 PM
I am running LabVIEW 5.1 full development with a PCI-6602 counter board.
I would like to generate an output pulse after counting x number of input pulses. I would also like to reset the counter with an external signal.
My application is I am trying to generate a second index pulse for an encoder.
I would like to count the pulses from encoder phase A and generate an output pulse on x number of counts. Then I would like to reset the counter using the encoder’s index pulse. This way I can change the phase of the “generated” index pulse with respect to the “real” index pulse by x number of counts (degrees) and maintain that regardless of encoder rpm.
Thanks
Brian
10-17-2005 01:52 PM - edited 10-17-2005 01:52 PM
Message Edited by Tom W. on 10-17-2005 01:52 PM
10-18-2005 10:09 AM
Brian,
There actually is a way to do what you want, but it gets a little complicated. I don't have LV on this machine so I'll have to just describe the idea. First a summary: the counter will repeatedly countdown to 0. Each time it reaches 0, it will generate a brief pulse which will in turn hw-reset the counter value to N. Then it will countdown to 0 again, etc. The same brief pulse could also be wired to a different encoder-measuring counter to create a "delayed" reset to 0 (or some other #).
1. Configure your counter for "position measurement" instead of "simple event counting". Set the encoder type to, um, I forget the name -- something like "two pulse encoder." It's the setting that will increment with every SOURCE edge and decrement with every AUX edge. Wire your encoder channel A to the counter's default AUX input (in position encoder mode, you must use the default input pins). Hard wire from the default SOURCE input to GND. Now every encoder edge will decrement the count, and nothing wlil ever increment it.
2. Configure the counter to use z-indexing. Set the z-index reload value to be N-1, where N is the # of encoder counts by which to delay the encoder's real z-index pulse. Set the z-index reload phase appropriately, probably to A low B low. Wire the real z-index pulse to the counter's GATE input.
3. Configure the counter to "pulse on terminal count" -- you do this using 'Counter Set Attribute.vi'. So N encoder edges after the real z-index pulse, you'll generate a pseudo-z-index with this counter.
4. You can wire this pseudo-z-index to the GATE input of the encoder-measuring counter. Now the encoder's z-index pulse is delayed by an amount you can program.
5. Note: this method requires the motion to be uni-directional.
Good luck!
-Kevin P.
10-18-2005 11:19 AM
Thanks Kevin.
That looks like a good idea I will give that a try.
I appreciate you taking the time.
Brian
10-20-2005 12:41 PM
10-21-2005 10:41 AM
10-21-2005 12:23 PM
10-21-2005 03:05 PM
Okay thanks Tom and Kevin.
No I haven't tried to run anything yet, just playing around with these counter settings trying to figure it out.
I haven't found any info on the legal combinations for the set attributes ID and value, it's a little confusing for me.
I will try to explain my application without being too boring.
A friend of mine is building a small scale V-twin 4 stroke model engine similar to a Harley.
We want to use LV to control things like ignition timing, fuel and monitor things like rpm and temp during the prototyping stage.
I am concentrating on ignition timing right now. I think I have the other stuff figured out.
We will have a quadrature encoder w/index mounted on the camshaft. I need to generate 2 pulses per rev of the encoder.
These pulses will fire an ignition module. The module will fire the coils and plugs.
We want to be able to adjust ignition timing during our testing.
I would like to generate the pulses delayed from index by x number of ticks(ignition timing) and the pulse widths(dwell) x number of ticks.
This way I can change timing (x number of ticks) with respect to the index. The index will keep things in sync every revolution.
If I can set the pulse width with number of ticks then the pulse width (dwell) will be linear with speed just like points on older engines.
I am concentrating on generating one pulse right now. I figure I can duplicate whatever counter configuration that works later for the second pulse.
Single direction and counting one encoder phase should be okay for now.
Thanks
Brian
10-24-2005 11:16 AM