CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

4x4 matrix keypad with interrupts

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
delene



Joined: 13 Oct 2003
Posts: 32

View user's profile Send private message Send e-mail

4x4 matrix keypad with interrupts
PostPosted: Mon Nov 07, 2011 7:31 am     Reply with quote

Hi

I have a 4x4 keypad connected to portb with the pull ups enabled. Previously I had been checking the keypad in my main code, but now would like to change my code to use interrupts rather.
I tried int_rb, but couldn't come right
I then tried int_rtcc - and didn't come right.
I now have timer1 enabled and it is occassionally reading the keypad.

Is this the best way of trying to read the keypad through interrupts?

I am using a pic18f4523
My crystal is 20MHz

and timer1 is setup as follows

Code:
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);      //26.2 ms overflow
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
enable_interrupts(INT_TIMER1);
enable_interrupts(GLOBAL);


Many thanks
Delene
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Nov 07, 2011 8:23 am     Reply with quote

In Search enter the three words: keypad, matrix and interrupts then set to "Search for All terms" and you will find this:

http://www.ccsinfo.com/forum/viewtopic.php?t=40982&
_________________
Google and Forum Search are some of your best tools!!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 07, 2011 1:12 pm     Reply with quote

This thread has sample code for polling the keypad every 10ms inside
the Timer0 interrupt routine:
http://www.ccsinfo.com/forum/viewtopic.php?t=45935
delene



Joined: 13 Oct 2003
Posts: 32

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 07, 2011 11:54 pm     Reply with quote

Thanks Everyone

I eventually came right. I used this code

http://www.ccsinfo.com/forum/viewtopic.php?t=19726
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group