Scott wrote: > Hello Again, > > I have another project comprised of a 16 push-button membrane keypad. > I am using a 18F2420, which is a pretty vanilla 18F PIC with enough > I/O and a UART and I2C. I simply need to detect a button press and > send it over both the UART and I2C. > > I have some questions/seeking advice. > > I might stick 8 buttons on Port A and 8 buttons on Port B. Pull down > each Normally Open button to ground, and a button press will pull the > line high. > Are you sure you can do this? if you are using a readymade matrix keypad it will probablly be wired as a matrix that needs to be scanned. > I've never interfaced anything to the PGD/PGC lines, should I put a > 10K (100K?) resistor in series with the pin, then go to the > pulldown/switch (see: > http://img.photobucket.com/albums/v55/goldscott/pgd-pgc-question.png)? > 10K should be enough to allow in circuit programing. Note that if using an ICD2 it doesn't like it's programming pins pulled up so make sure you arrange your pullups and pulldowns so they pull the line low rather than high when no buttons are pressed. > What are some ways to go about this while keeping power low? I know I > can poll each button until I find one high, but the processor will > always be at full power doing this. What about using a simple logic > gate to OR/NOR all the switches together to an interrupt pin to wake > the processor up? > It's certainly an option, another option is to have the pic wake up on a timer (say once a millisecond), read the keys and then go back to sleep. > What other suggestions do you have, and what issues might I run into? > As well as the above you may need to consider debouncing in some way. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist