Shop OBEX P1 Docs P2 Docs Learn Events
Using the DTMFout command — Parallax Forums

Using the DTMFout command

TravisMTravisM Posts: 7
edited 2007-05-09 18:42 in BASIC Stamp
I need help in developing an efficient code to enter phone numbers, using only a keypad,·into the EEPROM to be used for the DTMFout command. I am using a BS2 OEM board. The part of the code that I have developed·for entering phone numbers, which is not working, is way to long. I get notices that the memory is full, and even after I reduce the code enough that I no longer get the notices, the operation is very irratic.

I am using a Grayhill 96AB2-102F keypad. The seven pins are connected to P1 - P7 of the controller, with the inputs pulled high through resistors. The keypad operates according to the·following table:

Grayhill 96AB2-102F Keypad
··
······ Button····· ··········· · Inputs Shorted
·
··········· 1········· ··········· ··········· 3· - 7
··········· 2········· ··········· ··········· 2 – 7
··········· 3········· ··········· ··········· 1 – 7
··········· 4········· ··········· ··········· 3 – 6
··········· 5········· ··········· ··········· 2 – 6
··········· 6········· ··········· ··········· 1 – 6
··········· 7 ········ ··········· ··········· 3 – 5
··········· 8········· ··········· ··········· 2 – 5
··········· 9········· ··········· ··········· 1 – 5
··········· 0········· ··········· ··········· 2 – 4
··········· *········· ··········· ··········· 3 – 4
··········· #········· ··········· ··········· 1 – 4
·
Example:
·
All inputs are pulled high, so initially, IN3 and IN7 will be high. If· IN7 is set low, with Button 1 pressed, IN3 will also be low.

Also, I see that I still have an old thread which was a response to a previous question. How can I get that deleted from the forum?

Thanks, TravisM

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-05-09 03:22
    If "all inputs are pulled high" then all the pins will initially be high. I'm not sure how you would test for a press when two pins are shorted. I'll think on that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • TravisMTravisM Posts: 7
    edited 2007-05-09 04:47
    Regarding the Keypad - controller operation, and the example described in the previous post, the code LOW 7 will cause the P7 output, which is connected to pin 7 of the keypad, to go low. When button 1 of the keypad is pressed, pins 3 and 7 of the keypad are shorted. Since pin 3 of the keypad·is connected to P3 of the controller, P3 will also be low. Testing P1, P2, and P3, while sequentially taking P7, P6, P5, and P4 low·will reveal that only P3 is low, thus button 1 must be the one being pressed.

    I hope this explanation helps clarify how I am entering the numbers into the controller.

    Thank you, TravisM
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-05-09 17:20
    Hi Travis, I may have misinterpereted the data sheet but I thought it was like this, might be worth a second look.

    1=1+5
    2=1+6
    3=1+7
    4=2+5
    5=2+6
    6=2+7
    7=3+5
    8=3+6
    9=3+7
    *=4+5
    0=4+6
    #=4+7

    Anyway here is a sample you can adjust and see if you can capture the keypad input, it assumes pins 0-3 as the outputs to the keypad and pins 4-6 as the input to the Stamp. It also assumes pins 4 5 & 6 held low and pins 0 1 2 & 3 cycling high. Its no where near complete but just a first step in detecting the input, put in a few debugs to check it out.

    Jeff T.
  • TravisMTravisM Posts: 7
    edited 2007-05-09 18:26
    Jeff;
    Thanks for your suggestion. I did reverse the order of the keypad pins, but since I ohmed out the pins, it didn't make any difference. I did it the hard way and didn't bother looking at the data sheet. I am able to store phone numbers in the EEPROM, but I'm using so much code to do it I don't have enough memory left for all the other things I need to do. If I can make your code work, it will take up a lot less room. My experience, and knowledge, is pretty much limited to IF - THEN, FOR - NEXT, and DO - LOOPs. Keying the numbers in efficiently is just part of my problem. My main problem is retrieving the numbers from memory and using the DTMFout command. The code is retrieving only every other digit from memory. I store the first phone number (up to 4 phone numbers can be stored) in locations 0 through 10, but only locations 0, 2, 4, and 6 get retrieved. Since I am using a whole byte to store each digit, perhaps the DTMFout command expects the digit to be stored as a nible. Looks like your code may do that. I will try it out.

    Thanks, TravisM
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-05-09 18:42
    Hi Travis, a possible solution to retrieving data and storing the number in an array

    x VAR Byte
    y VAR Byte
    number VAR Byte(10)

    WRITE 0,"1","2","3","4","5","6","7","8","9" '//..............'example data

    FOR x=0 TO 8

    READ x,number(x)

    NEXT

    DEBUG STR number

    Jeff T.

    EDIT BTW data is stored a byte in each memory location


    Post Edited (Unsoundcode) : 5/9/2007 6:50:30 PM GMT
Sign In or Register to comment.