minimizing DTMF progam
coors
Posts: 28
I am using this code for my DTMF line however I am adding it to another program I already have and I need to lose one of the byte variables cause I do not have to variable space for it.· Is there a way for it to·just·dial a phone number written out instead·of it going to the EEprom looking for it.· We want minimize variable space as much as we can.· ANy help will be appreciated...thanks.
' {$STAMP BS2e}
' {$PBASIC 2.5}
Line PIN 10 ' DTMF output on pin 10
TmAdj CON $100 ' x 1.0 (time adjust)
eeLoc VAR Byte ' EEPROM address of stored number
eeByte VAR Byte ' Byte containing two DTMF digits
dtDig VAR eeByte.NIB1 ' Digit to dial
phone VAR Nib ' Pick a phone #
hiLo VAR Bit ' Bit to select upper and lower nib
Cellular DATA $30,$5X,$XX,$XX,$XX,$FF·· 'Phone: 305-XXX-XXXX
Main:
PAUSE 500
' retrieve address
LOOKUP phone, [noparse][[/noparse]Cellular], eeLoc
GOSUB Dial_Number
PAUSE 2000
END
Dial_Number:
DO
READ eeLoc, eeByte ' Retrieve byte from EEPROM
eeLoc = eeLoc + 1 ' point to next pair of digits
FOR hiLo = 0 TO 1 ' Dial upper and lower digits
DEBUG HEX4 ? dtDig, CR
IF (dtDig = $F) THEN EXIT ' Hex $F is end-of-number flag
DTMFOUT Line, ' dial digit
150 */ TmAdj, 25, [noparse][[/noparse]dtDig] ' 150 ms on, 25 ms off
eeByte = eeByte << 4 ' Shift in next digit
NEXT
LOOP UNTIL (dtDig = $F)
RETURN
' {$STAMP BS2e}
' {$PBASIC 2.5}
Line PIN 10 ' DTMF output on pin 10
TmAdj CON $100 ' x 1.0 (time adjust)
eeLoc VAR Byte ' EEPROM address of stored number
eeByte VAR Byte ' Byte containing two DTMF digits
dtDig VAR eeByte.NIB1 ' Digit to dial
phone VAR Nib ' Pick a phone #
hiLo VAR Bit ' Bit to select upper and lower nib
Cellular DATA $30,$5X,$XX,$XX,$XX,$FF·· 'Phone: 305-XXX-XXXX
Main:
PAUSE 500
' retrieve address
LOOKUP phone, [noparse][[/noparse]Cellular], eeLoc
GOSUB Dial_Number
PAUSE 2000
END
Dial_Number:
DO
READ eeLoc, eeByte ' Retrieve byte from EEPROM
eeLoc = eeLoc + 1 ' point to next pair of digits
FOR hiLo = 0 TO 1 ' Dial upper and lower digits
DEBUG HEX4 ? dtDig, CR
IF (dtDig = $F) THEN EXIT ' Hex $F is end-of-number flag
DTMFOUT Line, ' dial digit
150 */ TmAdj, 25, [noparse][[/noparse]dtDig] ' 150 ms on, 25 ms off
eeByte = eeByte << 4 ' Shift in next digit
NEXT
LOOP UNTIL (dtDig = $F)
RETURN
Comments
Dial_Phone:
· SELECT theNumber
·· ·CASE 0 : DTMFOUT Line, 150 */ TmAdj, 25, [noparse][[/noparse]"11115551212"]
··· CASE 1 : DTMFOUT Line, 150 */ TmAdj, 25, [noparse][[/noparse]"12225551212"]
·· ·CASE·2 : DTMFOUT Line, 150 */ TmAdj, 25, [noparse][[/noparse]"13335551212"]
· ENDSELECT
· RETURN
This lets you set the value of 'theNumber' to dial the appropriate phone.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Post Edited (Jon Williams) : 4/7/2005 1:33:07 AM GMT