calculator-like code entry with matrix keypad and display


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    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 19:44.
    All progress began with an idea

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