Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing BS2 to Keypad — Parallax Forums

Interfacing BS2 to Keypad

TravisMTravisM Posts: 7
edited 2005-09-19 18:00 in BASIC Stamp
I am in the process of developing a special purpose·phone system, similar to a standard phone unit with the pre-programmed one key dialing feature. I am trying to interface the BS2 to a keypad, with BS2 I/O pins P0 - P9 corresponding to the keypad keys 0 - 9, * to P10, # to P11.· My problem is in storing the numbers entered by the keypad in a manner that they can be used by the DTMFOUT PBASIC command. The DTMFOUT command wants the characters to be in groups of two, separated by commmas. The numbers are entered by the keypad one at a time. If you can help me with this code I would appreciate it.

Thank You.

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-09-18 21:16
    TravisM -

    Al little more information may be needed before we can offer much help. Who is the manufacturer of the keypad, or where did you buy it? How is the keypad encoded, or isn't it? Before you answer those questions though, read further, as your question may be answered differently below.

    I'm not sure what you mean when you say "The DTMFOUT command wants the characters to be in groups of two, separated by commas". Here is a typical DTMFOUT command, and as you can see the tones are simple, single digit numeric values:

    DTMFOUT 0, [noparse][[/noparse]1, 9, 1, 6, 6, 2, 4, 8, 3, 3, 3]

    Alternatively, the tone parameters could be variables which are part of an array, like this:

    DTMFOUT 0, [noparse][[/noparse]t(0), t(1), t(2), t(3), t(4), t(5), t(6), t(7), t(8), t(9), t(10)]

    or just ordinary variables, like this:

    DTMFOUT 0, [noparse][[/noparse]t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10]

    The choice is yours, and all are valid forms of the DTMFOUT command. I suppose this may preclude your original question.

    Regards,

    Bruce Bates
  • Robert KubichekRobert Kubichek Posts: 343
    edited 2005-09-18 21:24
    TravisM said...
    I am in the process of developing a special purpose phone system, similar to a standard phone unit with the pre-programmed one key dialing feature. I am trying to interface the BS2 to a keypad, with BS2 I/O pins P0 - P9 corresponding to the keypad keys 0 - 9, * to P10, # to P11. My problem is in storing the numbers entered by the keypad in a manner that they can be used by the DTMFOUT PBASIC command. The DTMFOUT command wants the characters to be in groups of two, separated by commmas. The numbers are entered by the keypad one at a time. If you can help me with this code I would appreciate it.



    Thank You.

    I do not think that you can do it, because the phone system requires dual tones for each of the 16 digits (0-9 # * A B C D) in a high tone, low tone
    format, where the last 4 tones ( A B C D ) are special keys. Comprised of a 4x(3or4) matrix of 8 distinct tones on a keypad....

    Bob N9LVU scool.gif
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-09-18 22:03
    Bob -

    The DTMFOUT command takes care of the outbound DTMF dual-tone encoding, so I'm not sure I see your point. DTMFOUT is really nothing more than a special case of FREQOUT, which also permits dual tones to be generated.

    Regards,

    Bruce Bates
  • Robert KubichekRobert Kubichek Posts: 343
    edited 2005-09-18 23:29
    Bruce Bates said...
    Bob -

    The DTMFOUT command takes care of the outbound DTMF dual-tone encoding, so I'm not sure I see your point. DTMFOUT is really nothing more than a special case of FREQOUT, which also permits dual tones to be generated.

    Regards,

    Bruce Bates

    Ok, you're right, then it is doable depending upon what type of keypad matrix/connections he is using for his project...

    Bob N9LVU scool.gif
  • TravisMTravisM Posts: 7
    edited 2005-09-19 18:00
    Thanks Bruce for your help. Being able to use single digit numeric values in the DTMFOUT command solved my problem. I was going by an example that grouped the digits in twos. I guess this was done to·conserve memory space, since just one byte would be used to store two digits. Since memory space is not a problem for my application, your solution works great for me.

    Thanks again, TravisM
Sign In or Register to comment.