Shop OBEX P1 Docs P2 Docs Learn Events
KeyPad Data — Parallax Forums

KeyPad Data

ArchiverArchiver Posts: 46,084
edited 2000-06-22 23:27 in General Discussion
I have a 16 key keypad attached to my stamp through a 74c922 decoder.

Here is my problem. I need to enter a numer from the keypad: Example
85 and store that number in to a varible.

How do I write software that will alow me to enter more then one
number and put the that combination into one var.

Right now i press one key to increase the number and an other to
decrease the number then that total will be stored into a var.

Thanks!!!

Tobin M.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-06-22 15:32
    That number was just an example, i need to enter any numbers between
    0 and 200.

    Thanks anyway!!!

    Tobin

    --- In basicstamps@egroups.com, "Mohamed REFKY" <refky@h...> wrote:
    > This is also what I want to do,her is my idea:
    > Take the first number 8 and multiply it by 10 then add it to 5 you
    get
    > 85.When You press a third number for example 2,take the last valu
    85 and
    > again mupltiply it by 10 then add it to 2 you get 852.
    > So you always take the key value and add it to the last value
    mualtiplied
    > by 10.First Number must not multiplies by 10 unless Basic Stamp
    receives
    > the secnond number 5.
    >
    > Regards
    > Mohamed REfky
    >
    > >From: ttm@g...
    > >Reply-To: basicstamps@egroups.com
    > >To: basicstamps@egroups.com
    > >Subject: [noparse][[/noparse]basicstamps] KeyPad Data
    > >Date: Wed, 21 Jun 2000 23:12:08 -0000
    > >
    > >I have a 16 key keypad attached to my stamp through a 74c922
    decoder.
    > >
    > >Here is my problem. I need to enter a numer from the keypad:
    Example
    > >85 and store that number in to a varible.
    > >
    > >How do I write software that will alow me to enter more then one
    > >number and put the that combination into one var.
    > >
    > >Right now i press one key to increase the number and an other to
    > >decrease the number then that total will be stored into a var.
    > >
    > >Thanks!!!
    > >
    > >Tobin M.
    > >
    > >
    > >
    > >
    > >
    >
    >
    ______________________________________________________________________
    __
    > Get Your Private, Free E-mail from MSN Hotmail at
    http://www.hotmail.com
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-22 17:08
    Tobin,

    Mohamed's reply was correct. Take the following code for example...


    Buffer var byte
    Key var byte

    Buffer = 0
    Main:
    ' Get your key value and store it in "Key"
    Key = [noparse][[/noparse]Key value]

    ' Shift Numbers in Buffer one place to the left
    ' And add your last key value
    Buffer = Buffer * 10 + Key
    Goto Main


    When you start the program Buffer is set to 0. Now lets say you press the
    key "1"

    Buffer = Buffer * 10 + Key
    or
    Buffer = 0 * 10 + 1
    so
    Buffer = 1

    The value in Buffer now equals 1. Next you press "2"

    Buffer = Buffer * 10 + Key
    or
    Buffer = 1 * 10 + 2
    so
    Buffer = 12

    And just to prove it works for zero..
    The value in buffer is now 12 and you press "0"

    Buffer = Buffer * 10 + Key
    or
    Buffer = 12 * 10 + 0
    so
    Buffer = 120

    The only limitation to this code that I can see is that you can't have
    leading zeros (002 for example), but it should work for your values of zero
    to 200.

    Jared

    Electrolinx - http://www.geocities.com/electrolinx/
    VB Overdrive - http://extreme-vb.net/vboverdrive/



    Original Message
    From: <ttm@g...>
    To: <basicstamps@egroups.com>
    Sent: Thursday, June 22, 2000 10:32 AM
    Subject: [noparse][[/noparse]basicstamps] Re: KeyPad Data


    > That number was just an example, i need to enter any numbers between
    > 0 and 200.
    >
    > Thanks anyway!!!
    >
    > Tobin
    >
    > --- In basicstamps@egroups.com, "Mohamed REFKY" <refky@h...> wrote:
    > > This is also what I want to do,her is my idea:
    > > Take the first number 8 and multiply it by 10 then add it to 5 you
    > get
    > > 85.When You press a third number for example 2,take the last valu
    > 85 and
    > > again mupltiply it by 10 then add it to 2 you get 852.
    > > So you always take the key value and add it to the last value
    > mualtiplied
    > > by 10.First Number must not multiplies by 10 unless Basic Stamp
    > receives
    > > the secnond number 5.
    > >
    > > Regards
    > > Mohamed REfky
    > >
    > > >From: ttm@g...
    > > >Reply-To: basicstamps@egroups.com
    > > >To: basicstamps@egroups.com
    > > >Subject: [noparse][[/noparse]basicstamps] KeyPad Data
    > > >Date: Wed, 21 Jun 2000 23:12:08 -0000
    > > >
    > > >I have a 16 key keypad attached to my stamp through a 74c922
    > decoder.
    > > >
    > > >Here is my problem. I need to enter a numer from the keypad:
    > Example
    > > >85 and store that number in to a varible.
    > > >
    > > >How do I write software that will alow me to enter more then one
    > > >number and put the that combination into one var.
    > > >
    > > >Right now i press one key to increase the number and an other to
    > > >decrease the number then that total will be stored into a var.
    > > >
    > > >Thanks!!!
    > > >
    > > >Tobin M.
    > > >
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    > ______________________________________________________________________
    > __
    > > Get Your Private, Free E-mail from MSN Hotmail at
    > http://www.hotmail.com
    >
    >
    >
    >



    __________________________________________________
    Do You Yahoo!?
    Talk to your friends online with Yahoo! Messenger.
    http://im.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-22 19:02
    Last step is to have one key on the keypad desiginated as an enter key
    so that when that key press is detected the loop which is collecting key
    presses
    knows when the number is complete. Like this....

    Buffer var byte
    Key var byte
    Enter_Key var byte 'this is the value to look for
    'as the enter key.
    Buffer = 0

    GetInp: 'was Main:
    ' Get your key value and store it in "Key"
    Key = [noparse][[/noparse]Key value]
    If Key = Enter_Key GOTO SetInp
    ' Shift Numbers in Buffer one place to the left
    ' And add your last key value
    Buffer = Buffer * 10 + Key
    Goto GetInp

    SetInp:
    'Now we have the desired value
    'do whatever with it....
    '
    'Dont forget to check for new keypresses now and then..





    Original Message
    From: Jared Hoylman [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=g4A0fciMNGkiTl1CN1YXclc7eI5CUd4mnL6rjEt89FbukOuSCI-rk0Pbcbio49ZhrqiNN-iFfLR5tfLBFc04]electrolinx@y...[/url
    Sent: Thursday, June 22, 2000 9:09 AM
    To: basicstamps@egroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Re: KeyPad Data


    Tobin,

    Mohamed's reply was correct. Take the following code for example...


    Buffer var byte
    Key var byte

    Buffer = 0
    Main:
    ' Get your key value and store it in "Key"
    Key = [noparse][[/noparse]Key value]

    ' Shift Numbers in Buffer one place to the left
    ' And add your last key value
    Buffer = Buffer * 10 + Key
    Goto Main


    When you start the program Buffer is set to 0. Now lets say you press the
    key "1"

    Buffer = Buffer * 10 + Key
    or
    Buffer = 0 * 10 + 1
    so
    Buffer = 1

    The value in Buffer now equals 1. Next you press "2"

    Buffer = Buffer * 10 + Key
    or
    Buffer = 1 * 10 + 2
    so
    Buffer = 12

    And just to prove it works for zero..
    The value in buffer is now 12 and you press "0"

    Buffer = Buffer * 10 + Key
    or
    Buffer = 12 * 10 + 0
    so
    Buffer = 120

    The only limitation to this code that I can see is that you can't have
    leading zeros (002 for example), but it should work for your values of zero
    to 200.

    Jared

    Electrolinx - http://www.geocities.com/electrolinx/
    VB Overdrive - http://extreme-vb.net/vboverdrive/



    Original Message
    From: <ttm@g...>
    To: <basicstamps@egroups.com>
    Sent: Thursday, June 22, 2000 10:32 AM
    Subject: [noparse][[/noparse]basicstamps] Re: KeyPad Data


    > That number was just an example, i need to enter any numbers between
    > 0 and 200.
    >
    > Thanks anyway!!!
    >
    > Tobin
    >
    > --- In basicstamps@egroups.com, "Mohamed REFKY" <refky@h...> wrote:
    > > This is also what I want to do,her is my idea:
    > > Take the first number 8 and multiply it by 10 then add it to 5 you
    > get
    > > 85.When You press a third number for example 2,take the last valu
    > 85 and
    > > again mupltiply it by 10 then add it to 2 you get 852.
    > > So you always take the key value and add it to the last value
    > mualtiplied
    > > by 10.First Number must not multiplies by 10 unless Basic Stamp
    > receives
    > > the secnond number 5.
    > >
    > > Regards
    > > Mohamed REfky
    > >
    > > >From: ttm@g...
    > > >Reply-To: basicstamps@egroups.com
    > > >To: basicstamps@egroups.com
    > > >Subject: [noparse][[/noparse]basicstamps] KeyPad Data
    > > >Date: Wed, 21 Jun 2000 23:12:08 -0000
    > > >
    > > >I have a 16 key keypad attached to my stamp through a 74c922
    > decoder.
    > > >
    > > >Here is my problem. I need to enter a numer from the keypad:
    > Example
    > > >85 and store that number in to a varible.
    > > >
    > > >How do I write software that will alow me to enter more then one
    > > >number and put the that combination into one var.
    > > >
    > > >Right now i press one key to increase the number and an other to
    > > >decrease the number then that total will be stored into a var.
    > > >
    > > >Thanks!!!
    > > >
    > > >Tobin M.
    > > >
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    > ______________________________________________________________________
    > __
    > > Get Your Private, Free E-mail from MSN Hotmail at
    > http://www.hotmail.com
    >
    >
    >
    >



    __________________________________________________
    Do You Yahoo!?
    Talk to your friends online with Yahoo! Messenger.
    http://im.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-22 22:49
    Thanks!!!!

    Thats that works great!!!

    Tobin Moore

    --- In basicstamps@egroups.com, "Witherspoon, Michael J"
    <michael.j.witherspoon@i...> wrote:
    > Last step is to have one key on the keypad desiginated as an enter
    key
    > so that when that key press is detected the loop which is collecting
    key
    > presses
    > knows when the number is complete. Like this....
    >
    > Buffer var byte
    > Key var byte
    > Enter_Key var byte 'this is the value to look for
    > 'as the enter key.
    > Buffer = 0
    >
    > GetInp: 'was Main:
    > ' Get your key value and store it in "Key"
    > Key = [noparse][[/noparse]Key value]
    > If Key = Enter_Key GOTO SetInp
    > ' Shift Numbers in Buffer one place to the left
    > ' And add your last key value
    > Buffer = Buffer * 10 + Key
    > Goto GetInp
    >
    > SetInp:
    > 'Now we have the desired value
    > 'do whatever with it....
    > '
    > 'Dont forget to check for new keypresses now and then..
    >
    >
    >
    >
    >
    >
    Original Message
    > From: Jared Hoylman [noparse][[/noparse]mailto:electrolinx@y...]
    > Sent: Thursday, June 22, 2000 9:09 AM
    > To: basicstamps@egroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Re: KeyPad Data
    >
    >
    > Tobin,
    >
    > Mohamed's reply was correct. Take the following code for example...
    >
    >
    > Buffer var byte
    > Key var byte
    >
    > Buffer = 0
    > Main:
    > ' Get your key value and store it in "Key"
    > Key = [noparse][[/noparse]Key value]
    >
    > ' Shift Numbers in Buffer one place to the left
    > ' And add your last key value
    > Buffer = Buffer * 10 + Key
    > Goto Main
    >
    >
    > When you start the program Buffer is set to 0. Now lets say you
    press the
    > key "1"
    >
    > Buffer = Buffer * 10 + Key
    > or
    > Buffer = 0 * 10 + 1
    > so
    > Buffer = 1
    >
    > The value in Buffer now equals 1. Next you press "2"
    >
    > Buffer = Buffer * 10 + Key
    > or
    > Buffer = 1 * 10 + 2
    > so
    > Buffer = 12
    >
    > And just to prove it works for zero..
    > The value in buffer is now 12 and you press "0"
    >
    > Buffer = Buffer * 10 + Key
    > or
    > Buffer = 12 * 10 + 0
    > so
    > Buffer = 120
    >
    > The only limitation to this code that I can see is that you can't
    have
    > leading zeros (002 for example), but it should work for your values
    of zero
    > to 200.
    >
    > Jared
    >
    > Electrolinx - http://www.geocities.com/electrolinx/
    > VB Overdrive - http://extreme-vb.net/vboverdrive/
    >
    >
    >
    >
    Original Message
    > From: <ttm@g...>
    > To: <basicstamps@egroups.com>
    > Sent: Thursday, June 22, 2000 10:32 AM
    > Subject: [noparse][[/noparse]basicstamps] Re: KeyPad Data
    >
    >
    > > That number was just an example, i need to enter any numbers
    between
    > > 0 and 200.
    > >
    > > Thanks anyway!!!
    > >
    > > Tobin
    > >
    > > --- In basicstamps@egroups.com, "Mohamed REFKY" <refky@h...>
    wrote:
    > > > This is also what I want to do,her is my idea:
    > > > Take the first number 8 and multiply it by 10 then add it to 5
    you
    > > get
    > > > 85.When You press a third number for example 2,take the last
    valu
    > > 85 and
    > > > again mupltiply it by 10 then add it to 2 you get 852.
    > > > So you always take the key value and add it to the last value
    > > mualtiplied
    > > > by 10.First Number must not multiplies by 10 unless Basic Stamp
    > > receives
    > > > the secnond number 5.
    > > >
    > > > Regards
    > > > Mohamed REfky
    > > >
    > > > >From: ttm@g...
    > > > >Reply-To: basicstamps@egroups.com
    > > > >To: basicstamps@egroups.com
    > > > >Subject: [noparse][[/noparse]basicstamps] KeyPad Data
    > > > >Date: Wed, 21 Jun 2000 23:12:08 -0000
    > > > >
    > > > >I have a 16 key keypad attached to my stamp through a 74c922
    > > decoder.
    > > > >
    > > > >Here is my problem. I need to enter a numer from the keypad:
    > > Example
    > > > >85 and store that number in to a varible.
    > > > >
    > > > >How do I write software that will alow me to enter more then
    one
    > > > >number and put the that combination into one var.
    > > > >
    > > > >Right now i press one key to increase the number and an other
    to
    > > > >decrease the number then that total will be stored into a var.
    > > > >
    > > > >Thanks!!!
    > > > >
    > > > >Tobin M.
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    ______________________________________________________________________
    > > __
    > > > Get Your Private, Free E-mail from MSN Hotmail at
    > > http://www.hotmail.com
    > >
    > >
    > >
    > >
    >
    >
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Talk to your friends online with Yahoo! Messenger.
    > http://im.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-22 23:27
    This is also what I want to do,her is my idea:
    Take the first number 8 and multiply it by 10 then add it to 5 you get
    85.When You press a third number for example 2,take the last valu 85 and
    again mupltiply it by 10 then add it to 2 you get 852.
    So you always take the key value and add it to the last value mualtiplied
    by 10.First Number must not multiplies by 10 unless Basic Stamp receives
    the secnond number 5.

    Regards
    Mohamed REfky

    >From: ttm@g...
    >Reply-To: basicstamps@egroups.com
    >To: basicstamps@egroups.com
    >Subject: [noparse][[/noparse]basicstamps] KeyPad Data
    >Date: Wed, 21 Jun 2000 23:12:08 -0000
    >
    >I have a 16 key keypad attached to my stamp through a 74c922 decoder.
    >
    >Here is my problem. I need to enter a numer from the keypad: Example
    >85 and store that number in to a varible.
    >
    >How do I write software that will alow me to enter more then one
    >number and put the that combination into one var.
    >
    >Right now i press one key to increase the number and an other to
    >decrease the number then that total will be stored into a var.
    >
    >Thanks!!!
    >
    >Tobin M.
    >
    >
    >
    >
    >

    ________________________________________________________________________
    Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
Sign In or Register to comment.