how to configure multi click in keypad


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2009
    Posts
    9

    Default how to configure multi click in keypad

    hi every one

    i have keypad with 12 buttons(1-9 ,#,*)

    so

    i need to read character from user

    i think the idea is by making a short time loop for each input from the keypad for example 1sec. The purpose of the loop to count how many times you clicks the button within the 1 sec. if you click just once then it gives you a character for example (a) . if you press it twice then it gives you another character (b).


    but i dont know how program it

    any help plzzz
    Last edited by ilham M; - 21st May 2009 at 11:20.

  2. #2
    Join Date
    Apr 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    anybody here ??

    i want just ahead for loop with time how can i write it??

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    As a new member to this forum, Welcome !
    To get help here Usually (not always), requires some simple effort, in this case, look at the threads listed under " CODE EXAMPLES", and come back with your questions, after finding some nice example code, and chewing on it a while. There are some Tasty morsels in there.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Apr 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    really i didnt Expect reply like this
    not because i expect every body hurry to help me
    BUT
    because
    it is clear how much i thinked & searched in web


    any way thank u so mush


  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Not asking you to search the web, I am asking you to search this forum.
    OK, I will take you by the hand, and lead you.
    1. http://www.picbasic.co.uk/forum/forumdisplay.php?f=11 code examples link, click it.
    2.http://www.picbasic.co.uk/forum/showthread.php?t=3250 Wow look what I found there ! A matrix key routine ! And it works too !
    3.http://www.picbasic.co.uk/forum/showthread.php?t=6311 Another key routine ! Oh if only I had not gotten offended by Joe asking me to do something for myself !
    4.http://www.picbasic.co.uk/forum/showthread.php?t=3487 What? Another one ? ! ! !
    Look, God helps those who make an effort to help them selves, I am much inferior to God, so I really NEED you to make an effort. I stand by my original statement, I and everyone else will help you, but I will not come to your house and do it for you. You are Welcome here.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Apr 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Default



    thank u joe for ur effort.

    i read it before , and it is not answer my question

    thank u again.

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ilham M View Post


    thank u joe for ur effort.

    i read it before , and it is not answer my question

    thank u again.
    OK then tell us more about the problem, If I misunderstood what you are doing, please straighten me out. There is a table of abundance here, please do not go away hungry. Have you written some code that does not work ? If so please post it so we can see what you are trying to do.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  8. #8
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I think what iham wants is the kind of keypad entry you get with Mobile phone texting...

    ie.. Button '2' is also A B or C...

    So you press it once you get '2', you press it again within say 1 second, you get 'A', press again and you get 'B', and again you get 'C'... then back to '2' again, and so on. If you leave it more than 1 second, it remains with whatever the last selection was and moves to the next character position.

    This really means integrating the Keypad with a Display... because you will be changing the displayed value depending if the same key is pressed again within the timeout period, and having an Array for storing the resultant Alphanumeric Text 'string'.

  9. #9
    Join Date
    Apr 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    I think what iham wants is the kind of keypad entry you get with Mobile phone texting...

    ie.. Button '2' is also A B or C...

    So you press it once you get '2', you press it again within say 1 second, you get 'A', press again and you get 'B', and again you get 'C'... then back to '2' again, and so on. If you leave it more than 1 second, it remains with whatever the last selection was and moves to the next character position.

    This really means integrating the Keypad with a Display... because you will be changing the displayed value depending if the same key is pressed again within the timeout period, and having an Array for storing the resultant Alphanumeric Text 'string'.

    exactly Melanie

    in program how can i discrimination the time between presses ??

  10. #10
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    There are many ways of doing this...

    In the example appended (just to get you started), the Subroutine exits ONE SECOND after the Button has been pressed. If the Button is pressed within the one second period, a new value is assigned and the Counter is reset for one second again. Only when ONE Second has elapsed from the last Button press, will the subroutine exit with the key value.

    This Subroutine assigns ASCII numeric 2, or alphabetic A, B or C to the Button.

    You will have to expand this out across your entire keypad, and integrate LCD Display, but the principle remains the same. At the heart of this, we are simply counting 100 loops of 10mS each. 10mS is also a good debounce time, so it serves a dual purpose.
    Code:
    	ButtonA var PortB.0
    
    	CounterA var BYTE
    	CounterB var BYTE
    
    
    	'
    	'	Subroutine Assigns one of FOUR Characters 2,A,B,C when Button Pressed
    	'	---------------------------------------------------------------------
    	'	CounterA = Number of Button Presses (0-4)
    	'	CounterB = Number of 10mS Loops Executed 
    	'		also contains ASCII Character (or Zero) - on Exit
    	'
    GetKey2ABC:
    	CounterA=0
    	CounterB=0
    GetKey2ABCLoop:
    	If ButtonA=0 then 
    		CounterA=CounterA+1
    		If CounterA>4 then CounterA=1
    		CounterB=0
    		While ButtonA=0		
    			CounterB=CounterB+1
    			Pause 10
    			If CounterB>100 then goto GetKey2ABCExit
    			Wend
    		else
    		CounterB=CounterB+1
    		Pause 10
    		endif
    	If CounterB<100 then goto GetKey2ABCLoop
    GetKey2ABCExit:
    	Lookup CounterA,[0,"2ABC"],CounterB
    	Return

  11. #11
    Join Date
    Apr 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    thank u very much Melanie
    u give me the keys
    i will try it and expand it inshallah

Similar Threads

  1. 4x4 keypad Help
    By aaliyah1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 5th October 2010, 16:34
  2. 1 switch, 1 pin, "single click, double click..."
    By erice1984 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th April 2009, 04:22
  3. Universal Keypad System
    By aratti in forum Code Examples
    Replies: 3
    Last Post: - 18th January 2009, 13:06
  4. Keypad input test
    By Kalind in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th October 2008, 04:00
  5. Need help in matrix keypad coding
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th May 2008, 13:16

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts