The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2016, 08:18:54 20:18


Login with username, password and session length


Pages: [1]
Print
Author Topic: keypad and interrupt  (Read 1719 times)
0 Members and 1 Guest are viewing this topic.
babatundeawe
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 54
-Receive: 12


« on: January 21, 2011, 05:57:11 05:57 »

i intend to make this project a digital code lock. i want the micro to do other things but on tapping the keypad an iterrupt should occur and goto keypad isr for keyencoding after the encoding the program shud return to what it was doing. thanks
Logged
hate
Hero Member
*****
Offline Offline

Posts: 556

Thank You
-Given: 156
-Receive: 354


« Reply #1 on: January 22, 2011, 12:15:46 12:15 »

Possible with that configuration. U have to use a timer to scan the pins (i.e. columns, B0-B3) and when a change occurs in the current state of the pins the interrupt for pin change (the one on the B4-B7 pins) will trigger. Then comes the bouncing problem. U may use the same timer to disable the scanning for a certain debouncing period. I've applied this technique once in a project, it's quite complicated though.

Regards...
Logged

Regards...
TomJackson69
V.I.P
Active Member
*****
Offline Offline

Posts: 221

Thank You
-Given: 23
-Receive: 63


« Reply #2 on: January 23, 2011, 05:27:33 05:27 »

Remember port B has Interrupt On Change feature on RB7-RB4. --- as "hate" indicated above ---

If you use this feature, it will make detection of key press easier.
Set up the pin you want to use as Int-On-Change as INPUTand ENABLE it.

Use RBIE: RB Port Change Interrupt Enable bit

And RBIF: RB Port Change Interrupt Flag bit

Write an interrupt routine to compare OLD RB and NEW RB (upper 4 bits only, use AND to clear the lower nib)

If any of the pin change you will know and take action accordingly. A DEBOUNCE code also need.

You need to look at the SPEC to write your routine.

Good luck

Tom
« Last Edit: January 23, 2011, 05:45:00 05:45 by TomJackson69 » Logged

Con Rong Chau Tien
falcon _bd
V.I.P
Active Member
*****
Offline Offline

Posts: 139

Thank You
-Given: 66
-Receive: 117


falconbd.com


WWW
« Reply #3 on: January 23, 2011, 09:53:18 09:53 »

check it out

http://www.sonsivri.com/forum/index.php?topic=34335.msg108490#msg108490
Logged

babatundeawe
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 54
-Receive: 12


« Reply #4 on: January 26, 2011, 08:59:03 20:59 »

i will give all the sugestion a try and feed you guys back
Logged
babatundeawe
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 54
-Receive: 12


« Reply #5 on: January 28, 2011, 12:14:08 00:14 »

guys, i tried to make adjustment to the code as directed. but i noticed that gie is not cleared/disabled when the isr is called can u please tell where i am getting it wrong.
Logged
rtm
Junior Member
**
Offline Offline

Posts: 41

Thank You
-Given: 18
-Receive: 51



« Reply #6 on: January 28, 2011, 08:25:18 08:25 »

GIE is auto-cleared when interrupt is calling by hardware (if you jumping to interrupt routine by program it will be not cleared). To set it back when you go out from interrupt you need to use RETFIE instructon.

Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC