calculator-like code entry with matrix keypad and display


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Do GOTO :-)

    Al ......

    You rock !! Woooohoooo :-)

    Ok GOTO was the bug !
    for clearing the var's
    A0=A0-1 is solution for strange numbers appearing after first keypress.
    this problem is caused by the # value ( and the A,B,C,D keys would cause the same issue)

    I no longer need to run the code through the retry label anymore ..yay less code! :-)

    Any further thoughts mods etc ?

    Dennis

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    this problem is caused by the # value ( and the A,B,C,D keys would cause the same issue
    Dennis # character is intercepted by the IF/Then condition and the added " goto ini " command should have solved the issue. As far as A,B,C,D and F just place a trap with an additional IF/then condition. See the example:

    Code:
    If KeyPress >57 then Ini
    If KeyPress = "*" then goto retry
    Since only "*" ; "#" and numbers from "0" to "9" can pass the if/then condition, this should solve the problem.

    Take care.

    Al.
    Last edited by aratti; - 16th December 2009 at 23:49.
    All progress began with an idea

  3. #3


    Did you find this post helpful? Yes | No

    Default oh ??

    Quote Originally Posted by aratti View Post
    Dennis # character is intercepted by the IF/Then condition and the added " goto ini " command should have solved the issue. As far as A,B,C,D and F just place a trap with an additional IF/then condition. See the example:
    I get that ! :-)

    But whats the > 59 doing here?
    Code:
    If KeyPress >59 then Ini
    If KeyPress = "*" then goto retry
    Since only "*" ; "#" and numbers from "0" to "9" can pass the if/then condition, this should solve the problem.

    Take care.

    Al.
    Al.. the goto ini didn't solve the problem .. I had to add the A0=A)-1 ..one extra line no problem.
    I think with * it's not a problem because as soon as * is detected the program jumps to retry ...which clears the variables ..
    # is different and unfortunately does get included in the array , well at least that's what I'm guessing. Will definitely bug track to see what really happens :-) and feedback to you !

    Kind regards
    Dennis

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    But whats the > 59 doing here?
    Sorry Dennis, I have mistaken It should be 57 (If KeyPress >57 then Ini)

    57 is the ascii value for "9" so if a number is larger then 57 is not loaded into the array.

    Download the zipped application I have attached, and run it on your PC. It will help you in converting ascii into decimal hex or binary and vice versa.
    Just type into the box the corresponding value and press enter, you will have that value converted into the other three numerical sytem.

    enjoy.

    Al.
    Attached Files Attached Files
    All progress began with an idea

  5. #5


    Did you find this post helpful? Yes | No

    Default static to dynamic

    Hi again

    I'm wondering if this could become more dynamic in terms of the number of keypresses.
    At the moment the keypresses are limited to 3, after that number the program goes a little wonky because of the B0 var which holds the sum of the 3 keypresses (hats off to Al !)
    As soon as the desired/required number of keypresses has to increase, the so the need for multiplying increases .

    I'm sure the program could be easily sized for a much higher number of keypresses by having more if statements and multiplies. To neaten things up perhaps a single case statement could be used and a check is kept on the index A0 in a byte.
    With this in mind, the number of keypresses (number entered) could grow to the size of the number of characters on the LCD ( well almost :-))
    This of course now opens the door for a PIC calculator :-)

    Al,Ioannis,Joe S, Steve and Jerson ...THANK YOU for all the tips help and suggestions so far :-)
    Al thank you for your patience and persisitence and of course the final piece of the puzzle.

    This has taught me lot and has been a whole lot of fun!

    Again thanks all of you for all the help thus far.

    I will post the final code once things are neatened up and commented correctly :-) in the hopes someone finds this useful sometime !

    Kind regards
    Dennis

Similar Threads

  1. a little help with keypad on 18f4520 please
    By Dennis in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 24th November 2009, 21:38
  2. Keypad input test
    By Kalind in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th October 2008, 05:00
  3. Need help in matrix keypad coding
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th May 2008, 14:16
  4. LCD display not working properly
    By dilpkan in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 2nd February 2008, 08:43
  5. Keypad entry?
    By TONIGALEA in forum General
    Replies: 3
    Last Post: - 8th August 2004, 17:10

Members who have read this thread : 0

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