Page 1 of 1
0-1-2-3-2-1-0 Counter

Posted:
Wed Nov 03, 2021 10:42 pm
by david_wallis
Anyone got an example of how to do this? (if even possible?)
(
Re: 0-1-2-3-2-1-0 Counter

Posted:
Thu Nov 04, 2021 3:15 am
by David Ferguson
Give us an idea of what you want to do. Count input up/down button presses? Single Keypad button that cycles through that sequence? Counter that updates with time (ie. once per second)?
And what are you going to do with the output of this counter? Switch on outputs, control wiper delays?
What other devices to you have attached to the PDM? (Keypad, MoTeC dash, etc)?
Re: 0-1-2-3-2-1-0 Counter

Posted:
Fri Nov 05, 2021 5:51 pm
by david_wallis
It would be for things like ign and lights.
Would have used the counter output to determine mode or output state.
It’s not a need but for example if doing lights on a single keypad button, I’d rather not have side, low, hi, off and rather toggle up and then back down. Attached of relevance is a c125 and a keypad. Was hoping not to have to use a dash to accomplish this.
David
Re: 0-1-2-3-2-1-0 Counter

Posted:
Sat Nov 06, 2021 3:42 am
by David Ferguson
As someone that has designed many user interfaces using a very few inputs. I will suggest that you will not like this behavior very much. What happens is that you don't know when you press a button if the value it going to go up or down. If it goes the wrong way (or you want to go the other way), you have to press the button the maximum number of times to get the value you wanted.
A much better solution for multi-value control is to use a pair digital inputs wired to a Single-Pole Double-Throw (SPDT) toggle switch that is of type (Momentary on) - OFF - (Momentary Off). Pushing the switch up would increment the counter, pushing the switch down will decrement the counter. The user always knows whats going to happen, and if they use the wrong button, it's easy to reverse their change.
If you are going to just use a single button, then the "rollover" behavior is usually the best. Button always increments (or decrements), and when it reaches the end it starts back at the beginning.
I like the challenge of what you asked to do, so here is a PDM30 config that uses one button to count 0-1-2-3-2-1-0. I included some other counter samples that I have used as well.