Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Keypad Code

Status
Not open for further replies.

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?
 
gregmcc said:
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).
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top