View previous topic :: View next topic |
Author |
Message |
runtime
Joined: 15 Sep 2003 Posts: 36
|
Kaypad (12 Keys) on port C? |
Posted: Wed Jan 26, 2005 4:03 pm |
|
|
Hello,
I would like to know if I can connect a 12 keys keypad to Port C on a PIC18F252, all examples uses port B... (I need port B for other things).
Thank you
Peter |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Jan 26, 2005 5:53 pm |
|
|
If you are not using interrupts, then you can do the same with portc. Note that you may have to add external pullups if the examples use the portb internal pullups. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jan 26, 2005 11:52 pm |
|
|
Note that the CCS driver, kbc.c, recommends putting pull-ups on
the column pins. This is not correct. They should be on the row pins.
The reason is that the driver sequentially sets each column line low,
then it reads the port and tests the Row pins. If a row pin is not
connected to a column pin (by the user pressing a switch) then the
row pin is left floating. You'll read an indeterminate state. That's
why the pull-ups must go on the row pins.
Also part of the time, the driver leaves the column pins in a Hi-Z state.
It's not good design practice to have floating CMOS inputs (at least for
any length of time), so ideally the column pins should have pull-ups on
them as well.
You can use 10K resistors for the pull-ups. |
|
|
|