Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 22:53 01 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Keypad interrupt

Author Message
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 05:35pm 26 Jan 2016
Copy link to clipboard 
Print this post

I was wondering if someone can help me with some code. I want to be able to exit an interrupt by pressing any key on a keypad. The problem is the keypad won't work because it's in an interrupt already. I tried keypad close and then reopening it in the interrupt but no luck. Is there another way? I can't enter back into the main code until I reset by pressing a key. I would like to avoid using a seperate push button if I can. Thanks for any help!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 05:44pm 26 Jan 2016
Copy link to clipboard 
Print this post

How about a diode-gate?

I don't know if the MM scans the rows first, or the columns first, but if someone can chime in with that information, then a diode-gate would do it. This would produce a high on another separate input pin, when any key on the keypad is pressed.

What size matrix are you using?
Smoke makes things work. When the smoke gets out, it stops!
 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 05:58pm 26 Jan 2016
Copy link to clipboard 
Print this post

4x4 matrix keypad. Similar to the project you did for me. I just can't use your separate keypad control chip. That worked great to exit the interrupt by closing the com port. I'm stuck using only the 470 chip and the keypad command now. Edited by KRZ3 2016-01-28
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 06:03pm 26 Jan 2016
Copy link to clipboard 
Print this post

Oh, howdy.
I did not recognise your username, but I know you now.

How about something like this:





Assuming that the MM scans the columns first, then any keypress anywhere on the matrix will generate a high signal on the MM_INPUT line. You could monitor that input line for your reset press. Untested, but should work.
Smoke makes things work. When the smoke gets out, it stops!
 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 01:59am 27 Jan 2016
Copy link to clipboard 
Print this post

Thanks! I will try that out later today and let you know.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 03:11am 27 Jan 2016
Copy link to clipboard 
Print this post

You will need to work out which pins in the KEYPAD command are the outputs, and which are the inputs. I have drawn the diagram for columns as outputs, and rows as inputs.

You can work it out, by looking to see which set is high - if the columns are high, then they are most likely outputs and vice-versa. Change the diagram to suit.

If you use the KEYPAD command to detect a key-press, once in the routine you need to have the reset in, DISABLE the KEYPAD command, and allow the pressing of any key to trigger your reset via the diode-gate. If you don't disable the KEYPAD command, it will hop on over to that interrupt as soon as you press any key trying to RESET out of your code if you see what I mean.....

Last thing to do before leaving the code(having detected the RESET), is to re-enable the KEYPAD command and it's associated interrupt.

Let us know how you get on. Having not actually tried this myself, I would be interested in your results. It should work.
Smoke makes things work. When the smoke gets out, it stops!
 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 03:28am 27 Jan 2016
Copy link to clipboard 
Print this post

Gotcha, makes sense and I will report back later on results. Thanks again!
 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 05:43pm 27 Jan 2016
Copy link to clipboard 
Print this post

Grogster I can't thank you enough! It works perfect!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 06:42pm 27 Jan 2016
Copy link to clipboard 
Print this post

Lovely.
Thanks for letting us know.
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024