DIY Pendant configuration question

More
02 Aug 2015 15:51 - 02 Aug 2015 15:55 #61118 by cncbasher
Last edit: 02 Aug 2015 15:55 by cncbasher.

Please Log in or Create an account to join the conversation.

More
16 Aug 2015 22:34 #61449 by Delron

I saw the Matrix_kb HAL component, but concluded it was for the Mesa FPGA boards only. Is that correct? Or would it work for inputs from the parallel port as well?

In scan mode it will work with the parallel port too

Hi folks!
Well, the pendant is coming along well. I have the wheel encoder working properly so far and a couple of keys to select the axis of choice. I need to figure out the smoothing yet, but so far, so good.

Where I'm really stuck right now is understanding how to implement the matrix_kb component. I have a 2x7 matrix keypad hooked up to the parport. I cannot find a single example anywhere on how to make this component work. The documentation is to ambiquoius for me to understand.

Can one of you fine folks help me out here?

Cheers!

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 03:36 - 17 Aug 2015 03:37 #61464 by andypugh

Where I'm really stuck right now is understanding how to implement the matrix_kb component. I have a 2x7 matrix keypad hooked up to the parport. I cannot find a single example anywhere on how to make this component work. The documentation is to ambiquoius for me to understand.

2x7 might not be the most efficient way, as you are using 9 pins for 14 inputs.

Anyway, you need to decide if you want to use 2 inputs x 7 outputs or the other way round.

Then, looking at this HAL session
halcmd: loadrt matrix_kb config=2x7s
halcmd: show pin
Component Pins:
Owner   Type  Dir         Value  Name
     4  bit   IN          FALSE  matrix_kb.0.col-00-in
     4  bit   IN          FALSE  matrix_kb.0.col-01-in
     4  bit   IN          FALSE  matrix_kb.0.col-02-in
     4  bit   IN          FALSE  matrix_kb.0.col-03-in
     4  bit   IN          FALSE  matrix_kb.0.col-04-in
     4  bit   IN          FALSE  matrix_kb.0.col-05-in
     4  bit   IN          FALSE  matrix_kb.0.col-06-in
     4  bit   OUT         FALSE  matrix_kb.0.key.r0c0
     4  bit   OUT         FALSE  matrix_kb.0.key.r0c1
     4  bit   OUT         FALSE  matrix_kb.0.key.r0c2
     4  bit   OUT         FALSE  matrix_kb.0.key.r0c3
     4  bit   OUT         FALSE  matrix_kb.0.key.r0c4
     4  bit   OUT         FALSE  matrix_kb.0.key.r0c5
     4  bit   OUT         FALSE  matrix_kb.0.key.r0c6
     4  bit   OUT         FALSE  matrix_kb.0.key.r1c0
     4  bit   OUT         FALSE  matrix_kb.0.key.r1c1
     4  bit   OUT         FALSE  matrix_kb.0.key.r1c2
     4  bit   OUT         FALSE  matrix_kb.0.key.r1c3
     4  bit   OUT         FALSE  matrix_kb.0.key.r1c4
     4  bit   OUT         FALSE  matrix_kb.0.key.r1c5
     4  bit   OUT         FALSE  matrix_kb.0.key.r1c6
     4  u32   OUT    0x00000000  matrix_kb.0.keycode
     4  bit   OUT         FALSE  matrix_kb.0.row-00-out
     4  bit   OUT         FALSE  matrix_kb.0.row-01-out

The 2x7s config creates scan lines and a matrix of 2 output pins and 7 inputs pins.
Connect the 2 matrix_kb.0.row-NN-out pins to parport outputs, connect the 7 matrix_kb.0.col-NN-in pins to partport inputs.
Don't forget to add the matrix_kb.0 function to a HAL thread.
Then, if you press the key at the intersection of output 1 and input 5, the HAL pin matrix_kb.0.key.r1c34 will go true.
Last edit: 17 Aug 2015 03:37 by andypugh.
The following user(s) said Thank You: Delron

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 05:17 #61467 by Delron
Thanks Andy.

You shed a little more light on this for me. I'm still somewhat confused by it, but I'll stare at it for a while and maybe it will get clearer. I'm not very strong at the HAL programming yet, but I hack away till something makes, or breaks. ;)

I wish I could find an actual HAL example to pick away at.

Cheers!

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 05:20 #61468 by Delron
BTW, I was using a 2x7 matrix to save a couple of out pins for future LED's or such.
I'm using 2 out pins and 7 in pins for the matrix.

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 06:20 #61469 by Delron
I'm sitting at the cnc trying to make this work.

I added this to my cutom.hal file

# Setup the keypad Matrix
loadrt matrix_kb config=2x7s
net key_01 matrix_kb.0.row-00-out <= parport.1.pin-01-out
net key_02 matrix_kb.0.row-01-out <= parport.1.pin-14-out
net key_03 matrix_kb.0.col-00-in <= parport.1.pin-02-in
net key_04 matrix_kb.0.col-01-in <= parport.1.pin-03-in
net key_05 matrix_kb.0.col-02-in <= parport.1.pin-04-in
net key_06 matrix_kb.0.col-03-in <= parport.1.pin-05-in
net key_07 matrix_kb.0.col-04-in <= parport.1.pin-06-in
net key_08 matrix_kb.0.col-05-in <= parport.1.pin-07-in
net key_09 matrix_kb.0.col-06-in <= parport.1.pin-08-in


Seems that the in pins are triggering, but no responce on the HAL matrix_kb.0.key.r#c# pins according to "Show HAL Configuration" in Axis.

Still stumped here.

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 06:36 #61470 by andypugh

Seems that the in pins are triggering, but no responce on the HAL matrix_kb.0.key.r#c# pins according to "Show HAL Configuration" in Axis.
Still stumped here.


Did you add the function to a thread?

Do you need to set the inverse logic flag? (I don't know, I never tried it with a parport)
The following user(s) said Thank You: Delron

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 06:40 - 17 Aug 2015 06:49 #61471 by Delron
I thought the "loadrt matrix_kb config=2x7s" was adding the function.

ok Figured out something.

I added;
"addf matrix_kb.0 servo-thread"
to the mix and something is happening now. But very eratic.
Some key presses result in permanent true conditions, some not. The row outs seem to cycle very slowly. I think I'm lost. ;)
Last edit: 17 Aug 2015 06:49 by Delron.

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 07:00 #61472 by Delron

Seems that the in pins are triggering, but no responce on the HAL matrix_kb.0.key.r#c# pins according to "Show HAL Configuration" in Axis.
Still stumped here.


Did you add the function to a thread?

Do you need to set the inverse logic flag? (I don't know, I never tried it with a parport)


Hi Andy,

Thanks a TON!! Was both these items you said.
Works perfectly now. I'm on my way to a pretty sweet MPG pendant.

Cheers!

Please Log in or Create an account to join the conversation.

More
17 Aug 2015 07:03 #61473 by Delron
In case anyone want to see the configuation I used to get it to work.

# Setup the keypad Matrix
loadrt matrix_kb config=2x7s
addf matrix_kb.0 servo-thread
net key_01 matrix_kb.0.row-00-out <= parport.1.pin-01-out
net key_02 matrix_kb.0.row-01-out <= parport.1.pin-14-out
net key_03 matrix_kb.0.col-00-in <= parport.1.pin-02-in-not
net key_04 matrix_kb.0.col-01-in <= parport.1.pin-03-in-not
net key_05 matrix_kb.0.col-02-in <= parport.1.pin-04-in-not
net key_06 matrix_kb.0.col-03-in <= parport.1.pin-05-in-not
net key_07 matrix_kb.0.col-04-in <= parport.1.pin-06-in-not
net key_08 matrix_kb.0.col-05-in <= parport.1.pin-07-in-not
net key_09 matrix_kb.0.col-06-in <= parport.1.pin-08-in-not

# The Axis select inputs
net mpg-x axis.0.jog-enable <= matrix_kb.0.key.r1c6
net mpg-y axis.1.jog-enable <= matrix_kb.0.key.r1c5
net mpg-z axis.2.jog-enable <= matrix_kb.0.key.r1c4

Etc..etc..etc...

Please Log in or Create an account to join the conversation.

Time to create page: 0.097 seconds
Powered by Kunena Forum