Keypad Matrix macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Keypad Matrix macro

Postby Vmax549 » Mon Jan 29, 2018 11:27 pm

Has anyone done a Macro to read a keypad matrix 3x4 ??

(;-) TP
Vmax549
 
Posts: 1111
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Keypad Matrix macro

Postby dezsoe » Tue Jan 30, 2018 6:06 pm

I made some experiences with 2x8 matrix, but I found it unuseable. Since then I had no time to play with it, but if you find the way, tell it to Dale (and also me), who wanted the 2x8 matrix. :)
dezsoe
 
Posts: 498
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Keypad Matrix macro

Postby Vmax549 » Wed Jan 31, 2018 2:50 am

oK Programming a macro to read such is simple BUT teh problem lays with hooking teh Keypad matrix up to UCCNC. UCCNC reads pin to com. The keypad outputs pin to pin connectivity, you read pin to pin. If pin 2 has continuity with pin3 then you have pushed teh number 2 key.
I don't see anyway for UCCNC to read pin to pin.

(;-) TP
Vmax549
 
Posts: 1111
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Keypad Matrix macro

Postby beefy » Wed Jan 31, 2018 6:25 am

Terry,

just got in from work and seen your post. Did a quick Google to get some info so the following is just off the top of my head (so I may be stuffing up here).

Anyway, based on the 3x4 matrix schematics I've viewed, you could connect the 3 lines to output pins and the 4 lines to input pins. Make sure you don't accidentally connect an O/P to an O/P pin. I'd check with Balazs if there's anything bad about doing that (output to input).

Then the macro would put each of the 3 O/P lines high in sequence. When O/P 1 is high, the 4 inputs are sequentially scanned. Then O/P 1 is put low, and O/P 2 is put high and the 4 inputs scanned again. Then O/P 2 is put low, and O/P 3 is put high, and the 4 inputs scanned, and so forth. So in one loop, you've scanned 3 sets of 4 buttons = 12 buttons.

That seems to be how it's done with a microcontroller, it's just looping through the set of switches till one is found closed.

I also read that you can only have ONE switch at a time pressed, based on the way a matrix keypad is wired. So you may need to do some pre-emptive thinking and figure out what the effects would be if someone pressed several buttons at the same time. A look at a matrix keypad schematic should quickly show what would happen.

Keith.
beefy
 
Posts: 186
Joined: Mon Sep 05, 2016 10:34 am

Re: Keypad Matrix macro

Postby Vmax549 » Wed Jan 31, 2018 2:57 pm

Hi Keith NAW, I do not want to have it that bad to start manipulating UCCNC pins. I was just doing it to have something to do late at night. (;-) I am always looking for NEW User functions to work on.

IF I were needing a keypad that bad I would start with a rs232 version and work from there.

Unless UCCNC wants to dedicate a port just to a key matrix say port 5 (;-) and set up teh firmware to accomidate it. (;-)

(;-) TP
Vmax549
 
Posts: 1111
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Keypad Matrix macro

Postby Vmax549 » Wed Jan 31, 2018 2:58 pm

Hi Keith NAW, I do not want to have it that bad to start manipulating UCCNC pins. I was just doing it to have something to do late at night. (;-) I am always looking for NEW User functions to work on.

IF I were needing a keypad that bad I would start with a rs232 version and work from there.

Unless UCCNC wants to dedicate a port just to a key matrix say port 5 (;-) and set up teh firmware to accomidate it. (;-)

(;-) TP
Vmax549
 
Posts: 1111
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Keypad Matrix macro

Postby beefy » Wed Jan 31, 2018 6:50 pm

Sorry about the answer. Just trying to help.

I don't actually look at it as some "extreme" method of accomplishing what you want. Balazs could correct me but I don't see connecting an output to an input as anything dangerous or "way out there".

And like I said it's the standard way it seems to be done with microcontrollers.

So perhaps your question should have been how do you connect a 3x4 matrix to UCCNC. Then AFTER that you could focus on the macro.
beefy
 
Posts: 186
Joined: Mon Sep 05, 2016 10:34 am

Re: Keypad Matrix macro

Postby Vmax549 » Wed Jan 31, 2018 10:05 pm

Hi Keith , I think I see :ugeek: what you are saying I had not thought of it that way. I will try it later.

Thanks, (;-) TP
Vmax549
 
Posts: 1111
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Keypad Matrix macro

Postby Vmax549 » Sun Mar 04, 2018 10:45 pm

Hiya Keith I had a spare moment and tried your idea and it works. It only works so far as a plugin as I have not been able to get a MacroLoop to cooperate with the routine.

So YES you can run a keypad matrix in UCCNC. You could possibly go as high as 4x13 off of one port.

I can cross another project off the wish list . ;)

Thanks for the help.

(;-) TP
Vmax549
 
Posts: 1111
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Keypad Matrix macro

Postby alex_s » Mon Mar 05, 2018 8:07 am

if it might help i added a normal usb keyboard encoder to my matrix, so i could asign all function in uccnc via keycodes, seemed easier then to hock up either Modbus or use the I/O of the controller :)
i used an arcade cabinet input board for this, has 64 distinct keys assignable by software with 2*8 direction inputs which can also be mapped to keys
alex_s
 
Posts: 62
Joined: Tue Nov 29, 2016 11:45 am


Return to Macros

Who is online

Users browsing this forum: No registered users and 1 guest