Shop OBEX P1 Docs P2 Docs Learn Events
serial keypad — Parallax Forums

serial keypad

Dan TaylorDan Taylor Posts: 207
edited 2010-02-11 18:51 in BASIC Stamp
Could someone show me an example program for the 4x4 keypad sold by ucontroller.com? I tried a simple SERIN program but a lot of the buttons come back with the same result. Any guidance would be nice!
Thanks!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor

Comments

  • JDJD Posts: 570
    edited 2010-02-10 20:14
    Dan,

    Can you post the information you have about the module you are using (datasheet and so forth) and the program you are trying to use with it? That way, we can see what all you have and try to offer some suggestions to get you up and running.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • Dan TaylorDan Taylor Posts: 207
    edited 2010-02-10 20:21
    There is no datasheet that I know of.

    But the programs that I have tried have just been something like this:


    serin, 5, 9600, [noparse][[/noparse]value]
    debug ? value

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • dandreaedandreae Posts: 1,375
    edited 2010-02-10 20:22
    You can contact Brian at Brian@uController.com·for this information.· He maybe able to give the information for·this set up.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • Dan TaylorDan Taylor Posts: 207
    edited 2010-02-11 17:48
    This is what Brian told me:


    "Is the baud rate set to 9600 ? also sometimes you have the option of inverting, if such an option exists, see if that helps.
    The data is returned as an ASCII code,· so you won't receive a "1" when 1 is pressed, you'll instead receive a "49" in decimal, or "31" in hex, whatever number base you are using."


    So, Yes my baud rate is set to 9600. He doesn't use the BASIC Stamp so he couldn't write me a program. Here is a program I just ran along with the results:

    DO
    · SERIN 3, 9600, [noparse][[/noparse]Value]
    · DEBUG CR, DEC Value
    LOOP

    Key····· ·Value
    1·····=···· 6
    2·····=···· 24
    3·····=···· 60
    4·····=···· 96
    5···· =···· 102
    6···· =···· 120
    7···· =···· 126
    8···· =···· 0 OR 128
    9···· =·····134
    0···· =···· 0
    *···· =···· 152
    #···· =···· 30
    A···· =·····6
    B···· =·····24
    C···· =···· 30
    D···· =···· 96

    As you can see some of the buttons return with the same value. Such as the Button 1 and the button A both return with the value 6.
    This is the problem I am having.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-11 18:05
    The 2nd parameter to SERIN is not the Baud. It's a number calculated from the Baud and includes some other information as well. The Stamp Editor's help files and the "BASIC Stamp Syntax and Reference Manual" show how to construct this number and gives typical values. Look for the description of the SERIN statement.

    Try 84. That's for 9600 Baud, 8 bits, non-inverted.

    Post Edited (Mike Green) : 2/11/2010 6:11:59 PM GMT
  • JDJD Posts: 570
    edited 2010-02-11 18:14
    Dan,

    The value for 9600 baud for the BS2 is 84; can you verify you get the same results by replacing the 9600·in the code with 84 and running the program again? This is the command that Mike suggested to review, there is a table in the manual that provides common baud values on page 419.

    BASIC Stamp Syntax & Reference Manual:
    http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • Dan TaylorDan Taylor Posts: 207
    edited 2010-02-11 18:51
    Whoopss! Didn't quite understand that whole baud thing before.
    It is working wonderfully know! Thanks for you help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • JDJD Posts: 570
    edited 2010-02-11 18:51
    Excellent; just let us know if there is anything else we can help with. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
Sign In or Register to comment.