Using the DTMFout command
TravisM
Posts: 7
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
I hope this explanation helps clarify how I am entering the numbers into the controller.
Thank you, TravisM
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.
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
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