Keypad Code

gregmcc

Member
I've been looking through the keypad code from Nigel's tut site () 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?
 

Simply alter the routine so it only loops a number of times then gives up, return an unused value (like 255) in W so you can check if a button was pressed or not (or set a flag).
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…