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 support@ccsinfo.com

keypad not working properly after sometime...

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



Joined: 16 Dec 2005
Posts: 22

View user's profile Send private message

keypad not working properly after sometime...
PostPosted: Sat Feb 11, 2006 8:15 pm     Reply with quote

hi,

i'm using KBD.C driver of the CCS C compiler to drive a 3x4 keypad. At first, it was working fine. But after some time of editing and adding codes, the keypad doesn't work reliably already. For example, if I press '1' button, it wud sometimes recognize it as '2' or '3'. If I press '*', it will give me a '#' or '0'. What could possibly be wrong?

I see this code in the KBD.C file:
#define KBD_DEBOUNCE_FACTOR 33 // Set this number to apx n/333
// n is the number of times you expect
// to call kbd_getc each second


I suspect that this is the reason why I could not get proper data from the keypad. Can anybody give me idea how to solve for the right value for the debounce factor? I don't have idea on how long will it take for the pic to execute one instruction.(well, i believe that execution time will be dependent on the instruction it has to execute.)

If there are any other causes of the problem, what could that be? (is it a short in the keypad internal connection?)

Thank you very much...

kind regards,

-=alDin=- Rolling Eyes
Alberteinstein
Guest







post your code!
PostPosted: Mon Feb 13, 2006 8:57 pm     Reply with quote

Please some code.It's the only way you'll get help!
aldinlapinig



Joined: 16 Dec 2005
Posts: 22

View user's profile Send private message

how to solve for debounce factor?
PostPosted: Fri Feb 17, 2006 9:45 pm     Reply with quote

how can i solve for the debounce factor?

here's a part of my code:

Code:


.
.
.
in_count = 0;
lcd_putc("\f");

while(1) {
      k = kbd_getc();
      if(k!=0) {
         if((k!='*') && (k!='#')) {
            if(in_count <1) {
               kbd_data[in_count] = k;
               kbd_data[in_count + 1] = '\0';        //string terminator
               lcd_putc(kbd_data);
               in_count++;
            }
         }
         
         if(k=='*') {
            if(in_count > 0) {
               kbd_data[in_count] = '\0';
               in_count--;
               lcd_putc("\b \b");      // is there another way?
            }
         }

        if(k=='#') {
           if(in_count>0) {
              somewhere();
           }

           return;
        }   
    }
}


Embarassed
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