Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

reverse engineering the keypad module

Status
Not open for further replies.
Copy the code,paste it into an editor window, and save it as ledmatrix.bas
It works with LEDs on portB
 
Do you laugh or cry? That is the question.
 

Attachments

  • SmartSelect_20200314-120250_Firefox_copy_210x294.jpg
    SmartSelect_20200314-120250_Firefox_copy_210x294.jpg
    14.1 KB · Views: 173
We won't mention banging your head against the wall and/or throwing things
You can't start now... Were only at post 86...
led matrix.bas module??
If you do that, what's the point of the thread... Reverse engineer the modlue.... But then use it!!
The reason they write these modules is so you don't need to..

All you should need to do is slightly modify theirs to suit your application
#option KEYPAD_PORT PORTx
Done... Keypad can be on any!
 
You have a hardware problem. Row 3 must be connected to the row 1 input instead of row 3 input. Period.

Just a point of order. 74 replies to get to this point. It's quite possible that MrDEB actually had working code at some point prior to this, as he mentioned on a couple occasions that he was getting the wrong output or duplicate output for some key presses. Everyone chalked this up to bad code (which it still may have been), but if MrDEB had noticed or mentioned that a whole column (row?) was giving the wrong results, spotting the hardware problem might have (relatively) quickly resolved this.

Dave Jones from the EEVBlog says you are lucky when a board you built doesn't work as planned. You get to hone your troubleshooting skills and learn how things work. But in order to troubleshoot something, you need a logical approach. Probably the first step when noticing that some keys yielded screwy results should have been to map out the key response. Pressing key 1 gives a 1. Pressing key 2 gives a 2. Pressing key 5 gives a 5. Pressing key 9 gives a 1. Do this for all twelve keys, and it should have been noticed that 2 rows gave duplicate results.

But not taking time to map 12 buttons, the conclusion jumped to was a software problem, which it could have been in addition to a hardware problem but it's pretty clear it was never going to work with 2 columns tied together.

A logical approach (and more than a veneer of understanding) is necessary when writing code. Even more so when it comes to troubleshooting code/hardware interaction. Just pointing out the obvious I know.
 
If I had the ledmatrix.bas module to paste into my editor I would have done that already.
 
Just a point of order. 74 replies to get to this point. It's quite possible that MrDEB actually had working code at some point prior to this, as he mentioned on a couple occasions that he was getting the wrong output or duplicate output for some key presses. Everyone chalked this up to bad code (which it still may have been), but if MrDEB had noticed or mentioned that a whole column (row?) was giving the wrong results, spotting the hardware problem might have (relatively) quickly resolved this.

Dave Jones from the EEVBlog says you are lucky when a board you built doesn't work as planned. You get to hone your troubleshooting skills and learn how things work. But in order to troubleshoot something, you need a logical approach. Probably the first step when noticing that some keys yielded screwy results should have been to map out the key response. Pressing key 1 gives a 1. Pressing key 2 gives a 2. Pressing key 5 gives a 5. Pressing key 9 gives a 1. Do this for all twelve keys, and it should have been noticed that 2 rows gave duplicate results.

But not taking time to map 12 buttons, the conclusion jumped to was a software problem, which it could have been in addition to a hardware problem but it's pretty clear it was never going to work with 2 columns tied together.

A logical approach (and more than a veneer of understanding) is necessary when writing code. Even more so when it comes to troubleshooting code/hardware interaction. Just pointing out the obvious I know.
Been there, done that, no intention of getting the T-shirt.

Mike.
 
If I had the ledmatrix.bas module to paste into my editor I would have done that already
Go back to post #79.

Look in the first code section of that post, the one that starts with "module ledmatrix"
Copy the code from that section and save it as "ledmatrix.bas"

The second code section in post #79 is a main program module that you can use to test ledmatrix.bas along with keypad12
 
oups! I missed post#79. It looked like my beginning code so I failed to look closer.
Easy mistake since I started writing similar.
Question==would binary work? to put it into a const array?
first 4 bits are colums and next three are rows?
I attempted but didn't get anywhere.
portc=%00000010
 
oups! I missed post#79. It looked like my beginning code so I failed to look closer.
Easy mistake since I started writing similar.
Question==would binary work? to put it into a const array?
first 4 bits are colums and next three are rows?
I attempted but didn't get anywhere.
portc=%00000010

Geez oh grief. People go out of their way to write customized code that works and hand it to you on a silver platter and rather than saying thank you and moving on, you decide you want to do it a different way that you don't understand in the least.

In case you haven't noticed, the number of people willing to expend ANY effort on your behalf has just about reached ZERO. Ever stop to consider why that might be?!?
 
Last edited:
Question==would binary work? to put it into a const array?
Since we're now pushing post #100 and I already handed you a working module written in a form you should be able to understand, my answer would be no, there's no way to use binary or const arrays.

The code I wrote is the only possible solution. There's no other way to do it. Period.

...a little editing to add more leds to toggle
More than 12 LEDs have magically appeared all of a sudden?
 
Thanks for the clarification. Good to point out, in case somebody else reads that statement and gets the wrong idea.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top