Bendix KN62A, KR 87 and KX155

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Message
Author
User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Bendix KN62A, KR 87 and KX155

#21 Post by Sling »

Ok AM can do this but you will have to use the digital in and out as discrete lines. You will need to write a function that cycles through an output and checks the inputs and acts accordingly. The logic should use what output is currently active to know what switch has been rotated. You may be able to adapt the switch array function to do this or perhaps easier to use individual ins and outs. Let me know if you need a code example. I would need to know how an individual switch operates beforehand.

Tony
Last edited by Sling on Thu Feb 06, 2020 2:43 am, edited 1 time in total.

jasong
Posts: 101
Joined: Sun Oct 20, 2019 8:18 am

Re: Bendix KN62A, KR 87 and KX155

#22 Post by jasong »

Thanks Tony,
I'll get back to you when I'm in front of it again.

I also came across the CD74HC4067
mux.png
https://www.propwashsim.com/store/16ch- ... cd74hc4067

Is this some thing I can use to connect the 4 channels?

I already have some of these as they came with the Arduino starter kit I had.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Bendix KN62A, KR 87 and KX155

#23 Post by Sling »

No need really for an external multiplexer. They are good if you want to extend your number of I/O lines but Arduinos are pretty cheap and going direct keeps the code simpler.

Tony

jasong
Posts: 101
Joined: Sun Oct 20, 2019 8:18 am

Re: Bendix KN62A, KR 87 and KX155

#24 Post by jasong »

ok thanks

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Bendix KN62A, KR 87 and KX155

#25 Post by SimPassion »

Seeing the price for such CD74HC4067 multiplexer board,
to lower the global amount, I would rather use multiple Arduino Nano boards, for let say the Z_2D_XP CDU/FMC which would requires as much as 71 inputs for all available keys plus one dial

Is what you were thinking about @Sling Tony as board reference like Arduino Nano ?

Gilles

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Bendix KN62A, KR 87 and KX155

#26 Post by Sling »

@SimPassion Yes Gilles. Rather use direct pins of an Arduino than complicate the code and wiring by using an external multiplexer. I love the Nano board. It’s so small and great for sim projects. Cheap too.

Tony

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Bendix KN62A, KR 87 and KX155

#27 Post by SimPassion »

Thanks Tony, I will include the Nano wiring chart in my maps

Gilles

jasong
Posts: 101
Joined: Sun Oct 20, 2019 8:18 am

Re: Bendix KN62A, KR 87 and KX155

#28 Post by jasong »

Hi @Sling

I'm just getting back to this, yes please can you provide a code starter.... (or some logic to my confusion.)
Ok AM can do this but you will have to use the digital in and out as discrete lines. You will need to write a function that cycles through an output and checks the inputs and acts accordingly. The logic should use what output is currently active to know what switch has been rotated. You may be able to adapt the switch array function to do this or perhaps easier to use individual ins and outs. Let me know if you need a code example. I would need to know how an individual switch operates beforehand.

Tony
Ok, to solve this problem first, I think I need to know how to wire the switch circuit/Arduino to be able to read the COMMON line which is the only unique wire each dial has .
At the moment I have PULSE to A0, RIGHT A1, LEFT to A2 and the COMMON to GND.
This allows me to turn one dial and I get a result either the dial is turning down or up, this will work with the 4 dials as long as I don't connect the 4 COMMON lines to GND ie I only connect one at a time.

Is there another way to wire this up with the COMMON pins to another Arduino pin to read? (How do I set AM to read digital pins in or out?)

This is the code Chuck helped me with which check if the dials are turn one way or another.

Code: Select all

function rotary_encoder(new_pos)

	  if     new_pos == 1 and old_pos == 0 then print("DOWN = " .. tostring(new_pos) )
	  elseif new_pos == 1 and old_pos == 2 then print("UP = " .. tostring(new_pos) )
	  elseif new_pos == 2 and old_pos == 1 then print("DOWN = " .. tostring(new_pos) )
	  elseif new_pos == 2 and old_pos == 0 then print("UP = " .. tostring(new_pos) )
	  elseif new_pos == 0 and old_pos == 1 then print("UP = " .. tostring(new_pos) )
	  elseif new_pos == 0 and old_pos == 2 then print("DOWN = " .. tostring(new_pos) )
	end
	old_pos = new_pos
      end
I'm looking through your HW tutorials for any handy info.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Bendix KN62A, KR 87 and KX155

#29 Post by Sling »

jasong wrote: Mon Feb 17, 2020 4:49 am At the moment I have PULSE to A0, RIGHT A1, LEFT to A2 and the COMMON to GND.
This allows me to turn one dial and I get a result either the dial is turning down or up, this will work with the 4 dials as long as I don't connect the 4 COMMON lines to GND ie I only connect one at a time.

Is there another way to wire this up with the COMMON pins to another Arduino pin to read? (How do I set AM to read digital pins in or out?)
I need to know your hardware code for PULSE to A0, RIGHT A1, LEFT to A2. Your function name would indicate you are using hw_dial_add() for perhaps the left and right but as the hw_dial_add only needs 2 pins what are you using to read pulse.

Its quite easy to set up some code to cycle through the common's with outputs and then read them as you are. I need to now hardware functions you are using though (see above).

Tony

jasong
Posts: 101
Joined: Sun Oct 20, 2019 8:18 am

Re: Bendix KN62A, KR 87 and KX155

#30 Post by jasong »

Hi Tony

This is what I'm doing, it's a switch instead of hw_dial_add, as you said, what to do to read the pulse?

Code: Select all

ROT_SWITCH_ENC = hw_switch_add("ROTENCSWITCH", 3, rotary_encoder)
local old_pos = hw_switch_get_position(ROT_SWITCH_ENC)
Looking at your HW tutorial on youtube, you demonstrate a switch with 3 Pin positions and a GND, I think this is the same representation of what I have. All 4 "dials" (switches) are connected to the same 3 Pins but each has a different GND or Common Line.

Thanks for your help.

Post Reply