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 Joe's URL

    Joe ..

    Did you mean this URL ?
    http://www.picbasic.co.uk/forum/showthread.php?t=5695
    Yes I have been checking it out too that one out too.
    There's also this one
    http://www.picbasic.co.uk/forum/show...ight=door+lock
    and this one
    http://www.picbasic.co.uk/forum/show...ght=calculator

    Kind regards
    Dennis

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dennis View Post
    Joe ..

    Did you mean this URL ?
    http://www.picbasic.co.uk/forum/showthread.php?t=5695
    Yes I have been checking it out too that one out too.
    There's also this one
    http://www.picbasic.co.uk/forum/show...ight=door+lock
    and this one
    http://www.picbasic.co.uk/forum/show...ght=calculator

    Kind regards
    Dennis
    Hi Dennis,
    Yep, the first one, second page, where Lloyd posted the finished code he paid Mr_E to write. Since I do not know your exact plan here I thought you might discover how to handle the arrays and use the numbers. Also dunno why you use byte var hassel instead of using a word simply use something like
    Code:
    if tempx >999 then tempx = 999
    or instead of 999 you could cause the routine to jump to a subroutine that handles errors or make 999 into a zero so it works to simply overflow.
    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.

  3. #3


    Did you find this post helpful? Yes | No

    Default update

    Hi guys

    Just a few updates
    Jerson ...still trying to see what's wrong with the code snippet you send .. did you try it at all ?
    You mentioned raw characters .. did you mean I shouldn't do a lookup ?

    Joe... I'm busy going through the gate entry code.

    Will feedback as soon as I get more info :-)

    Kind regards
    Dennis

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


    Did you find this post helpful? Yes | No

    Default

    ......So the problem now is how to get numbers which are less than 3 digits to work.
    For example if I enter the number 99 I get 227 in MCS serial tool
    Another example is the number 1 (single digit) shows up as 195

    I am trying to figure out why but can't see it as yet.
    Dennis the reason is that the array are no cleared. Add the three lines in red to the previous snippet and you are in business

    Al.

    Code:
    Array var Byte [3]
    A0 var byte
    B0 var Byte
    KeyPress Var Byte ' will contain the ascii character of the key pressed
    
    A0=0
    
    Ini:
    If KeyPress = "#" then
    
    if A0=2 then
    B0= (Array[0]*100)+(Array[1]*10)+Array[2]
    HSEROUT [B0]
    endif
    
    if A0=1 then
    B0= (Array[0]*10)+Array[1]
    HSEROUT [B0]
    endif
    
    if A0=0 then
    B0= Array[0]
    HSEROUT [B0]
    endif
    
    A0=0
    Array[0]=0
    Array[1]=0
    Array[2]=0
    ENDIF
    
    If A0>2 then Ini
    
    Array[A0]=KeyPress -48
    A0=A0+1
    goto Ini
    PS. Dennis the matter was just more complicated so I added the complete correction. I sure you will understand where the problem was.
    Al.
    Last edited by aratti; - 16th December 2009 at 18:44.
    All progress began with an idea

  5. #5


    Did you find this post helpful? Yes | No

    Default still struggling..

    Joe

    Thanks for pointing me to the gate access example, unfortunately it does not cover what I am after.
    The gate combo program compares each digit as it is typed in to a pre-stored value in eeprom and based on a successful match eventually enable a pin to go high.
    Yes granted it does utilize mister_e's keypad code (thanks mister_e...brilliant job - it work's like a charm, no hassle no fuss!)

    It does do a lookup as does my example and this is to get the raw scan codes into a 'familiar' character.

    It does not capture each keypress into an array.
    It does not sum the individual keystrokes and present them as a single byte or word.

    I think the gate access code is awesome and I would just like to say thanks to Lloyd for offering the code after he had paid mister_e to write it.

    And after having said that, it may be a good time to point out that as much as it is easy and simple to cut and paste pre-built code into the compiler window, this method does nothing for one's education and learning experience. I would like to battle along with code snippets and tips and tricks to eventually get to a working solution , however rough and un-polished it may be.

    Yes , agreed , I'm sure it is less frustrating but where's the fun without battling along (especially for me a 'reborn' PIC newbie hobbyist) until 2 or 4am sometimes until I eventually get something working.
    I find the forum a fantastic place to get other ideas and share experiences with others who have the same interest , be it hobby or vocation or otherwise.

    As you know you can read the manual and google and read sources for hours and then eventually get to a point of giving up or coming right.
    I think most of the people on the forum post a message at the point where they have reached the stage where they want to bash their head against a wall and decide to eventually give in and post a message.
    Posting a message on the forums can be a rather daunting thought or task because quite often people flame someone for saying the wrong thing or being out of line, not only that, the person posting often feels quite shy since they may be laughed at or 'looked down upon' by some highly skilled few who don't suffer fools easily.
    After having battled for nearly 3 months now to get where I am at, I completely understand a newbie's plight to getting functional.
    And in the time I have been lurking around on these forums and seeing how to create new threads and add code snippets and URL's and also get into some sort of functional coding style.
    I am more than happy to help someone get functional with their project and hope that someday I will have as much knowledge as most of the people who frequent this forum.

    I would just like to say THANK YOU to all those who I have interacted with and who have offered assistance to my (sometimes) absurd and 'silly' questions :-)

    And a big THANK to all of the people on this forum for keeping it going !

    On a final note ....

    I am still battling to capture 3 keystrokes into a var/byte/array ,index them , and then add them all up so that they are represented by one byte.
    I just can't see where I am going wrong :-(

    Kind regards

    Dennis

  6. #6


    Did you find this post helpful? Yes | No

    Default Al ..........

    Hi Al


    Welcome back :-) and how are you tonight ?

    Was it Siesta time in Milano ?
    :-)

    Wondered if you had disappeared or given up on me :-)

    Will try it right now and feedback asap !

    By the way is that the reason for the anything but 3 bits correct value issue ?

    Dennis

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


    Did you find this post helpful? Yes | No

    Default

    Wondered if you had disappeared or given up on me :-)
    No Dennis, I had a long hard day at work!

    Did you read also my added code?

    Al.
    All progress began with an idea

  8. #8


    Did you find this post helpful? Yes | No

    Default something strange...

    Hi Al ...

    Sorry to hear about the long hard work day :-( it was a public holiday in my country .. so it felt like a weekend :-)

    I tried the code and checked the lines in red.

    I excitedly (stupidly I gues) just copied and pasted it in .... :-)
    Well it didn't I now only ever see a 0 in hyperterminal for any number keyed in following the #

    Time to debug :-) , if you see anything obvious just let me know and I will test.. will keep you posted

    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, 20:38
  2. Keypad input test
    By Kalind in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th October 2008, 04:00
  3. Need help in matrix keypad coding
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th May 2008, 13:16
  4. LCD display not working properly
    By dilpkan in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 2nd February 2008, 07:43
  5. Keypad entry?
    By TONIGALEA in forum General
    Replies: 3
    Last Post: - 8th August 2004, 16: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