![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
I've been looking through the keypad code from Nigel's tut site (http://www.winpicprog.co.uk/pic_tutorial9.htm) and would like to include it in my program. My asm is a bit rusty but from going through the code 'KEYS' procedure goes into a loop intul a key is pressed. In the program I am writing I need to constantly check one of the RA ports for a input so the program cannot loop at the keys subroutine otherwise it will never get to the input checking routine. What I need is something like: Main call check_keys ; above routine should return the key pressed in W, otherwise W=0 ; if W<>0 Then do something here call check_ra2 loop Main How do I go about getting the keypad routine to not loop until a key is pressed? | |
| |
| | #2 | |
| Quote:
| ||
| |
| | #3 |
|
Thanks - now why didn't I think of that | |
| |
| | #4 |
|
See key debouncing problems. If you want to avoid it use 74922 Code for interfacing Keypad with parallel port of a computer is available in book MY EXPERIENCE IN PARALLEL PORT INTERFACING It is a free book. You can get it from yahoo group-booksbybibin http://groups.yahoo.com/group/booksbybibin/ Bibin John www.bibinjohn.tk | |
| |
| | #5 |
|
or a 40-50ms delay and re-checking the keystate will be sufficent for debounce
__________________ Gods own Country Incredible !ndia www.flickr.com/photos/_akg/ "Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime." | |
| |
| | #6 | |
| Quote:
| ||
| |
|
| Tags |
| code, keypad |
| Thread Tools | |
| Display Modes | |
| |