#Using BCD rotary switch

1 messages · Page 1 of 1 (latest)

low forge
#

Hello.
Is it possible to use rotary switch encoder in binary ?
I am actualy designing the TCAS panel and need little rotary switch. Those tiny I can find has outputs in binary format

lucid haven
#

It may help if you post a link to this rotary switch, so everyone can know what you mean.

low forge
#

Its a classical BCD
Below you can find what it looks like and the coding it use.
1 wire on C pin then 4 wires on 1 2 3 4
With the position of the switch, the outputs pin send a binary code

#

For 3 first position I can use pins 1 2 3 but for the 4th position no.
I was wondering if in MF we can do something like "I1 and I2 and not I3" to set an input

lucid haven
#

I guess you can connect C to GND and 1 2 4 8 to arduino pins

low forge
#

OK but how MF will know BCD code?

lucid haven
#

read each pin as a button, assign the button to a MF variable

#

with same value

#

1 2 4 8

low forge
#

And so where can I make à boolean condition to set an input?

lucid haven
#

now you create one output config that adds all the MF variables

#

and based on the result, you trigger a different position input

low forge
#

Hummm let me check that in MB

#

Thx

lucid haven
#

I would guess you skip the 0 value since there is no signal generated in that position.

#

oh, the button config needs to use the on release to assign 0 back to the variable

#

I think in that case, 0 value can then be used also.

shrewd fjord
#

Woah. This is very interesting concept. Since the binaries are unique code in their own wiring. We can treat them as a matrix while still wiring them all to gnd 😮

lucid haven
#

the switch position number corresponds 1:1 with the added binary value of the pins 1 2 4 8

#

not sure what you mean by treating them as a matrix

lucid haven
# low forge Hummm let me check that in MB

To make things a bit less complicated, you can do the MF variables addition in one output called say SwitchPos, then create another set of outputs, one for each switch position. Bring in the SwitchPos value as a config reference and do a transform based on the value of SwitchPos

low forge
#

Variables are set in output section, right?

lucid haven
#

For example the Transform for the third position (counting from 0) would be
if(#=2,1,0)

lucid haven
#

The pin inputs are what you would use to set the MFvariables

low forge
#

I didn't find in input section but nevermind...I am right now designing the panel and the PCB. The principal is to know its possible. I will puzzle my mind when the panel will be finished

#

Thx again jaime

lucid haven
#

I don't recommend you design panel first. You should be breadboarding this first

#

I have never used this rotary switch, and this is just a concept right now. Untested.

low forge
#

OK OK i will test first. Thx

lucid haven