I have figured out that look at post #41With R1 - R4 connected to +, you will need to pull each column in RD0 - RD3 low to activate.
But what about our lives? I think the TS needs to get the concept design working first.The use of an I2C I/O expander might make your life easier.
You win the forum for today!But what about our lives? I think the TS needs to get the concept design working first.
I want to write program for matrix keypad if I press any key of keypad key number should be display on LCD screenYou need to show us what you have done before we can help. Before jumping in and presenting code, describe what you are trying to do, including port directions (input or output) and status if output (high or low).
A good way to handle debounce IMO is to just scan the keypad at some time interval, 1 ms maybe, until you find a closed button and return a 'scan code' representing that row and column. It doesn't matter what the actual code is at this point as long as it is unique - the bit patterns of the column out and row in (as drawn above) are good enough.This comment also ignores switch bounce. This whole scheme could be done in microseconds, and the switch may bounce for several milliseconds. I do see that you delay resetting RBIF for 40 ms, which is good. I am not sure that delay is in the right place. You may want the button bounce to settle down before testing the RD pins.
That code is not for keypad scanning. I mentioned this in post 70I do not see how the code posted in 60 will read the 4x4 matrix.
I read the datasheet and then write the code and I understand my code completelyActually, the code you posted in #43 pretty much does one scan and returns a unique code if it finds a key pressed and 00h if it doesn't.
.
I think pesudo code will help me moreYou asked for direct help in #65. What I've described is what I think is the more direct path to a solution based on the work you've done so far. But first, you have to understand the scanning process you show in #43. Do you understand that process?
unsigned char key_pressed(void)
{
unsigned char Key_Number;
Key_Number = 0;
if(!key1)
Key_Number = '1';
if(!key2)
Key_Number = '2';
if(!key3)
Key_Number = '3';
if(!key4)
Key_Number = '4';
debounce(1000);
}
I disagree. Why start with something new when #43 is so close to what you want??? What you show in #76 makes no sense whatsoever.I think pesudo code will help me more
code in #43 is for single buttonI disagree. Why start with something new when #43 is so close to what you want???
Code in #43 reads any button, one at a time, just like you would push them.code in #43 is for single button
Can you give pesudo code to understand how this will be implement for keypad ?