Shop OBEX P1 Docs P2 Docs Learn Events
dtmf — Parallax Forums

dtmf

coorscoors Posts: 28
edited 2005-04-06 17:38 in BASIC Stamp
Hi,
I am trying to have my BS2 dial a phone number, but for some reason I am having a problem.· I am using the Figure 5.3.· I believe that it is connected right.· I am using the demo program "DTMFOUT.bs2".· I have pasted my code onto this topic in case anyone can help me out.· When I run the program i pick up another phone on the same line and hear the numbers being dialed; after they are dialed it says that the area code, a 1, or 0, must not be dialed in order to get to this number.· This makes me think that I have connected the hardware part correctly.· Just to make sure does it matter which way the phone line (red and green) wired are connected?· How about the transformer, how do I know it is connected properly? Remember: I do hear the controller dial numbers, so I don't think this is the problem.
The problem might lie in the code.· I don't want to dial a "1" before the area code, is there a character that i need to input at the beginning at the number similar to the letter "F" that must be put at the end?· Or is the problem somewhere else? Any help would be appreciated.

' {$STAMP BS2}
' {$PBASIC 2.5}
Spkr PIN 10 ' DTMF output on pin 10
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
TmAdj CON $100 ' x 1.0 (time adjust)
'#CASE BS2SX
'TmAdj CON $280 ' x 2.5
'#CASE BS2P
'TmAdj CON $3C5 ' x 3.77
#ENDSELECT
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
Parallax DATA $13,$05,$XX,$XX,$XX,$XF ' Phone: 1-916-624-8333'I placed X's in place of my actual phone #
'ParallaxFax DATA $19,$16,$62,$48,$00,$3F ' Phone: 1-916-624-8003
'Information DATA $15,$20,$55,$51,$21,$2F ' Phone: 1-520-555-1212
Main:
PAUSE 500
FOR phone =0· TO 0
' retrieve address
LOOKUP phone, [noparse][[/noparse]Parallax], eeLoc
GOSUB Dial_Number
PAUSE 2000
NEXT
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
IF (dtDig = $F) THEN EXIT ' Hex $F is end-of-number flag
DTMFOUT Spkr, ' 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

  • coorscoors Posts: 28
    edited 2005-04-06 03:34
    Don't worry

    I figured it out.yeah.gif
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-06 12:44
    We're happy for you -- what was the problem, and how did you fix it?
  • coorscoors Posts: 28
    edited 2005-04-06 17:38
    I fixed it by not having a 1 of a 0 before the phone number.· So I had it starting with the phone number and just added at the end two F instead of one at the end.
Sign In or Register to comment.