Jog increments using a 6 position selector switch
Position Input 1 Input 2 Input 3
1 Off Off Off
2 On Off Off
3 Off On Off
4 On On Off
5 Off Off On
6 On Off On
and use an expanded version of my selector code.
John
Please Log in or Create an account to join the conversation.
Or wire the switch to multiplex the inputs.
Just another idea
Please Log in or Create an account to join the conversation.
If you have a one-pole N-position switch, you can build a simpleYou could use 2 mux 16, if debounce is important.
Or wire the switch to multiplex the inputs.
Just another idea
binary encoder with some diodes so as to get the maximum
functions from the minimum number of digital inputs.
Jon
Please Log in or Create an account to join the conversation.
If you have a one-pole N-position switch, you can build a simple
binary encoder with some diodes so as to get the maximum
functions from the minimum number of digital inputs.
Thinking about this, I am not sure you need the diodes. Is there any reason that a given switch-pole can't pull down several input pins? I don't see any issue with connecting DIO pins to each other.
a 3-bit gray code can encode 8 positions, (I would suggest gray-code for this, not binary)
en.wikipedia.org/wiki/Gray_code has tables for 2, 3 and 4 bits.
This also saves GPIO pins.
Please Log in or Create an account to join the conversation.
Well, except that the single-pole switch contacts would short the DIO pins together,jmelson wrote:
If you have a one-pole N-position switch, you can build a simple
binary encoder with some diodes so as to get the maximum
functions from the minimum number of digital inputs.
Thinking about this, I am not sure you need the diodes. Is there any reason that a given switch-pole can't pull down several input pins? I don't see any issue with connecting DIO pins to each other.
whether that position on the switch was selected or not,
so they would all be common. That's why the diodes are needed, so that
various switch settings will be able to select different combinations of
DIO pins.
Jon
Please Log in or Create an account to join the conversation.
Well, except that the single-pole switch contacts would short the DIO pins together,[/quote]
Ah. Yes. I think I must have still been asleep when I posted that.
Please Log in or Create an account to join the conversation.
If you have a one-pole N-position switch, you can build a simple
binary encoder with some diodes so as to get the maximum
functions from the minimum number of digital inputs.
Jon[/quote]
Here's a link to a drawing of my pendant that works this way :
pico-systems.com/images/minimill_pendant.pdf
and here's the hal code to go with it :
pico-systems.com/codes/minimill/pendant.hal
This uses my USC or UPC digital inputs, so the ppmc.0.din.##.in
are the digital input pins, those would need to be replaced with
whatever digital inputs you are using in your system.
It uses digital inputs to bring in the MPG A and B channels
since all the encoder counters were already in use.
The scale factors of 0.000025, etc. are because this is
a 100 cycle/rev encoder, so it provides 400 counts/rev.
or 4 counts per detent.
It includes feed-override and spindle-override as well as
jogging the axes.
I should mention that in this system, the digital inputs are
sourcing, ie. you ground them to indicate a signal on
that input, hence the polarity of the diodes. If your
digital inputs are sinking, meaning you supply a
positive voltage to them, the diodes should have their
polarity reversed.
Jon
Please Log in or Create an account to join the conversation.