Storing a number for use by DTMFOUT
Ive been working on a DTMF generator that will create one of two code sequences based on an input sensed by the stamp. When one input goes low it should generate a DTMF sequence similar to this 123#, when the other input goes low it should generate a sequence like this 1234*. I wanted to store the DTMF code sequence in the source code and uncomment the lines that are relevant. I can use constants to control every aspect of DTMFOUT with the exception of the actual digit sequence. I've attached the code I'm using. I'd appreciate a turn in the right direction. everything works right (or at least as I expect it to) except for the LIT_SEQ and LOT_SEQ portions.
thanks in advance,
Chris
'GPI_to_DTMF.bs2
'Program creates a DTMF sequence when it detects LIT and LOT GPI's originated by the IRD.
'The DTMF sequence is fed to the local ad insertion system which detects
'the tone sequence and executes the appropriate break in the playlist.
' {$STAMP BS2}
' {$PBASIC 2.5}
LIT_GPI PIN 3 'set input pin for LIT from IRD
LOT_GPI PIN 4 'set input pin for LOT from IRD
LIT_LED PIN 15 'set output pin for LIT led
LOT_LED PIN 14 'set output pin for LOT led
TONE_LED PIN 13 'set output pin for DTMF tone generator led
TONE_OUT PIN 12 'set output pin for DTMFOUT command
DURATION CON 75 'set dtmf tone duration to 50msec
DELAY CON 50 'set dtmf tone spacing to 50msec
LITWrk VAR Byte 'set workspace for LIT button
LOTWrk VAR Byte 'set workspace for LOT button
LIT_SEQ DATA "[noparse][[/noparse]1, 2, 3, 11]" 'Brazil LIT tone sequence, 123#
LOT_SEQ DATA "[noparse][[/noparse]1, 2, 3, 10]" 'Brazil LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Argentina LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Argentina LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Andes 1 - Peru LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Andes 1 - Peru LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Andes 2 - Venezuela LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Andes 2 - Venezuela LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Mexico LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Mexico LOT tone sequence, 321*
MAIN:
DEBUG HOME
DO
LIT:
BUTTON LIT_GPI, 0, 255, 0, LITWrk, 0, LOT
HIGH LIT_LED
HIGH TONE_LED
DTMFOUT TONE_OUT, DURATION, DELAY, [noparse][[/noparse]LIT_SEQ]
DEBUG "LIT"
LOW LIT_LED
LOW TONE_LED
LOT:
BUTTON LOT_GPI, 0, 255, 0, LOTWrk, 0, No_Press
HIGH LOT_LED
HIGH TONE_LED
DTMFOUT TONE_OUT, DURATION, DELAY, [noparse][[/noparse]LOT_SEQ]
DEBUG "LOT"
LOW LOT_LED
LOW TONE_LED
No_Press:
GOTO Main
LOOP
thanks in advance,
Chris
'GPI_to_DTMF.bs2
'Program creates a DTMF sequence when it detects LIT and LOT GPI's originated by the IRD.
'The DTMF sequence is fed to the local ad insertion system which detects
'the tone sequence and executes the appropriate break in the playlist.
' {$STAMP BS2}
' {$PBASIC 2.5}
LIT_GPI PIN 3 'set input pin for LIT from IRD
LOT_GPI PIN 4 'set input pin for LOT from IRD
LIT_LED PIN 15 'set output pin for LIT led
LOT_LED PIN 14 'set output pin for LOT led
TONE_LED PIN 13 'set output pin for DTMF tone generator led
TONE_OUT PIN 12 'set output pin for DTMFOUT command
DURATION CON 75 'set dtmf tone duration to 50msec
DELAY CON 50 'set dtmf tone spacing to 50msec
LITWrk VAR Byte 'set workspace for LIT button
LOTWrk VAR Byte 'set workspace for LOT button
LIT_SEQ DATA "[noparse][[/noparse]1, 2, 3, 11]" 'Brazil LIT tone sequence, 123#
LOT_SEQ DATA "[noparse][[/noparse]1, 2, 3, 10]" 'Brazil LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Argentina LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Argentina LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Andes 1 - Peru LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Andes 1 - Peru LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Andes 2 - Venezuela LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Andes 2 - Venezuela LOT tone sequence, 321*
'LIT_SEQ CON "[noparse][[/noparse]1, 2, 3, 11]" 'Mexico LIT tone sequence, 123#
'LOT_SEQ CON "[noparse][[/noparse]3, 2, 1, 10]" 'Mexico LOT tone sequence, 321*
MAIN:
DEBUG HOME
DO
LIT:
BUTTON LIT_GPI, 0, 255, 0, LITWrk, 0, LOT
HIGH LIT_LED
HIGH TONE_LED
DTMFOUT TONE_OUT, DURATION, DELAY, [noparse][[/noparse]LIT_SEQ]
DEBUG "LIT"
LOW LIT_LED
LOW TONE_LED
LOT:
BUTTON LOT_GPI, 0, 255, 0, LOTWrk, 0, No_Press
HIGH LOT_LED
HIGH TONE_LED
DTMFOUT TONE_OUT, DURATION, DELAY, [noparse][[/noparse]LOT_SEQ]
DEBUG "LOT"
LOW LOT_LED
LOW TONE_LED
No_Press:
GOTO Main
LOOP
Comments
·
[noparse][[/noparse] I get to do this at this time of day because it's Presidents' Day. ]
Post Edit -- I've been experimenting with this program, modified to dial 7 digits.··A big-deal gizmo from yesteryear was a little hand-held that you could use for a dialer.· [noparse][[/noparse]Anybody remember DAK, COMB, Damark?]· When I hold the speaker up to the handset's microphone (sort of direct "audio coupling") the tones aren't consistently recognized.· I'm trying to call my cell-phone, using my Caller-ID as my monitor,·and I'm having trouble with 1s & 6s.· Depending on the bypass cap and the·TimeOn used, I can get the 1s, but the 6s are tough.· Wondering why.· Tones quality, volume, both, neither?
Post Edited (PJ Allen) : 2/16/2009 9:22:29 PM GMT
PJ,
Thanks for the help. I managed to get it to work!
-Chris