Re: Quick 4x4 keypad matrix question

Originally Posted by
triton99
Thanks for the reply Archangel. In response to your questions...
1. Why are you putting in LCD defines if you are using the USART, Do you want dual display?
The LCD is used just for quick on-the-spot feedback. It was part of another program, so I usually just cut-and-paste it into other programs. The USART is just for debugging purposes. Plus it remindes me of the old BBS days

.
2. Since you did not specify which PIC you are using, which port is your PIC equipped to use the USART ? Is it the same as the keypad uses?
At the beggining I stated I was using an PIC 16F877 @ 20 mhz. The hardware USART TX/RX are ports C6/C7 on the 16F877 which are only being used for serial communication. The keypad is is connected to PORTB.0 to PORTB.7.
3. Why did you change the value of the resistors ? I suspect Bruce proved out his design before posting it on his website.
I was under the impression that the value of the resistors were not that important to a certain extent. While researching keypad matrices, a few people stated that any value <= 10k would be sufficient. I had 1k resistors with me at the time so i gave it a shot. I just replaced the 1k resistors with 270-ohm. It seemed to make the problem occur only on one button (row3-col1). While pressing the button repeatedly, the value displayed will sometimes be the value of the button directly below it, but only intermittently.
By changing the 1k resistors for 270 helped eliminate the problem on all the buttons except the one (row3-col1). I still cant figure what is causing this.
thanks again for the help.
Sean
Hi Sean, Ok . . .
1.OK . . . had to ask . .
2. Sorry old eyes, I missed that. Ok that's good.
3. Looked at Bruce's page again, his statement proves you right . . . non critical.
This code is floating around the forum in many threads, with many variations, and the only thing I see is no TRIS settings for your ports B,C, & D. In the 1 Mr._E did he set the portb Tris as follows: TRISB = %11110000 , he also used an interrupt to detect the keypress, it maybe your finger is faster than your loop, especially given you are using 3 different display protocols. I would comment out any code you are not pressed to use and see if it improves, also you might consider debug over serout as it executes faster using less code space ( or so they tell me) I have not yet proven that last statement to myself, but it is a bit faster, in terms of how long a loop takes to execute,
oh and try these defines (from mister E's famous picmulti calc)
Code:
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 129 ' 9600 Baud @ 20MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Last edited by Archangel; - 19th June 2011 at 10:39.
Reason: I really miss the Old Forum's text format
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks