Using Bs2p40 and Cermetek CH1786A modem to call a telephone number
JMLStamp2p
Posts: 259
Tech Support: The area that we have highlighted in blue is where we are trying to dial out a telephone number.
The rest of our code as far as receiving data transmissions is working fine. (Ecxept for when we Transmit ASCII characters, we Receive their Decimal equivalent.) ?!? However, when we try to dial out from our modem we cannot do so. We are monitoring the telephone lines and have a good connection. But when we run our program, we will get a dial tone then it will go "off hook" (seemingly to dial the number) have about 5 seconds of "off hook time" then repeat the process over and over again.
'·· {$STAMP BS2p}
'·· {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'
' Simple Emic TTS speech demo.· Be sure to set both Emic DIP switches to
' the OFF (down) position.
· AUXIO································ ' select AUXIO pins
· OUTS = $0000························· ' force outputs low
· DIRS = $FFFF
MAINIO
'
[noparse][[/noparse] I/O Definitions ]
TX1············ PIN···· 15
RX1············ PIN···· 14
'DCD············ PIN···· 13
Tx············· PIN···· 0······················ ' connects to Emic SIn
Rx············· PIN···· 1······················ ' connects to Emic SOut
Busy··········· PIN···· 2······················ ' 1 = busy
'
[noparse][[/noparse] Constants ]
#SELECT $STAMP
· #CASE BS2, BS2E, BS2PE
··· Baud······· CON···· 396········ ' 2400 baud, N81
· #CASE BS2SX, BS2P
··· Baud······· CON···· 1021
#ENDSELECT
Yes············ CON···· 1
No············· CON···· 0
··············································· ' Emic Commands (Hex Mode)
Say············ CON···· $00···················· ' say Engish text
Volume········· CON···· $06···················· ' set volume, 0 - 7
Speed·········· CON···· $00···················· ' set speed, 0 - 4
Pitch·········· CON···· $00···················· ' set pitch, 0 - 6
AddAbbr········ CON···· $04···················· ' add abbreviation
DelAbbr········ CON···· $05···················· ' delete abbreviation
ListAbbr······· CON···· $06···················· ' list abbreviations
Version········ CON···· $07···················· ' get version
Reset·········· CON···· $08···················· ' soft reset
Audio·········· CON···· $09···················· ' enable audio in
PhT············ CON···· $10···················· ' start of phonetic text
Help··········· CON···· $FE···················· ' display help
EOM············ CON···· $AA···················· ' end of message
OK············· CON···· $55··················· ' "okay" for hex mode
T2400·········· CON···· 1021
MAINIO
'LOW 4
'LOW 5··· 'Digital Display
'LOW 6
'LOW 8
'LOW 9
'LOW 10
'LOW 11
'LOW 12
'LOW 13
'LOW 14
'LOW 15
INPUT 4
OUTPUT 5
INPUT 6
INPUT 7
OUTPUT 8
OUTPUT 9
INPUT 10
OUTPUT 11
INPUT 12
INPUT 13
INPUT 14
OUTPUT 15
RecievedTransmitterData VAR Word 'Varible to hold Incoming Electrical codes
result VAR Byte
resultTwo VAR Byte
'
[noparse][[/noparse] Program Code ]
Main:
····GOTO Init
··· SERIN 4,1021, [noparse][[/noparse]RecievedTransmitterData]
··· DEBUG ? RecievedTransmitterData,CR
· '_________________________________________________________________________________________________________________________________
··· IF (RecievedTransmitterData = 49) THEN GOSUB Lights_On
··· IF (RecievedTransmitterData = 51) THEN GOSUB Lights_Off
··· IF (RecievedTransmitterData = 3) THEN GOSUB GroundFault
··· IF (RecievedTransmitterData = 4) THEN GOSUB ResetPumpSystem
··· IF (RecievedTransmitterData = 5) THEN GOSUB MainVoltageOffline
··· GOTO MAIN
·'__________________________________________________________________________________________________________________________________
··· Lights_On:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Welcome, I, am Angel. Shuler farms micro computer. All voltages and currents are, within design, limits.", EOM]
··· GOTO MAIN
· '__________________________________________________________________________________________________________________________________
··· Lights_Off:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Thankyou for stopping by, all systems are, operating correctly.", EOM]
··· GOTO MAIN
··· '_______________________________________________________________________________________________________________________________
··· Init:
··· SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATDT205-288-0936;", CR]
··· PAUSE 10000
··· SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATDT911", CR]
··· PAUSE 5000
··· SEROUT TX1, T2400, [noparse][[/noparse]"+++"]
··· PAUSE 2000
··· SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATH0", CR]
··· GOTO MAIN
··· '______________________________________________________________________________________________________________________________
··· Error:
··· DEBUG "The Error subroutine was called, Modem could not establish a connection ..."
··· PAUSE 1000
··· GOTO I_Modm ' try to initialize again
··· I_Modm: PAUSE 250 ' allow modem to power up
··· GOTO MAIN
·· '_______________________________________________________________________________________________________________________________
··· GroundFault:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Hello. All Systems are Operating Correctly!", EOM]
··· GOTO MAIN
··· ResetPumpSystem:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Good night John and Kevin!", EOM]
··· GOTO MAIN
··· MainVoltageOffline:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Attention. Main incoming primary voltage is off-line. I will restet contactors, when avalable!", EOM]
··· GOTO MAIN
'
[noparse][[/noparse] Subroutines ]
' Check status of Emic TTS module
' -- wait until Busy line released by Emic
' -- code as written does not timeout
Check_Busy:
· PAUSE 1
······································ ' allow busy to activate
· DO WHILE (Busy = Yes) : LOOP········ ' If Pin (2) is a Logical (1) then keep Looping
······································ ' When it goes "LOw" Return to Main
· RETURN
The rest of our code as far as receiving data transmissions is working fine. (Ecxept for when we Transmit ASCII characters, we Receive their Decimal equivalent.) ?!? However, when we try to dial out from our modem we cannot do so. We are monitoring the telephone lines and have a good connection. But when we run our program, we will get a dial tone then it will go "off hook" (seemingly to dial the number) have about 5 seconds of "off hook time" then repeat the process over and over again.
'·· {$STAMP BS2p}
'·· {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'
' Simple Emic TTS speech demo.· Be sure to set both Emic DIP switches to
' the OFF (down) position.
· AUXIO································ ' select AUXIO pins
· OUTS = $0000························· ' force outputs low
· DIRS = $FFFF
MAINIO
'
[noparse][[/noparse] I/O Definitions ]
TX1············ PIN···· 15
RX1············ PIN···· 14
'DCD············ PIN···· 13
Tx············· PIN···· 0······················ ' connects to Emic SIn
Rx············· PIN···· 1······················ ' connects to Emic SOut
Busy··········· PIN···· 2······················ ' 1 = busy
'
[noparse][[/noparse] Constants ]
#SELECT $STAMP
· #CASE BS2, BS2E, BS2PE
··· Baud······· CON···· 396········ ' 2400 baud, N81
· #CASE BS2SX, BS2P
··· Baud······· CON···· 1021
#ENDSELECT
Yes············ CON···· 1
No············· CON···· 0
··············································· ' Emic Commands (Hex Mode)
Say············ CON···· $00···················· ' say Engish text
Volume········· CON···· $06···················· ' set volume, 0 - 7
Speed·········· CON···· $00···················· ' set speed, 0 - 4
Pitch·········· CON···· $00···················· ' set pitch, 0 - 6
AddAbbr········ CON···· $04···················· ' add abbreviation
DelAbbr········ CON···· $05···················· ' delete abbreviation
ListAbbr······· CON···· $06···················· ' list abbreviations
Version········ CON···· $07···················· ' get version
Reset·········· CON···· $08···················· ' soft reset
Audio·········· CON···· $09···················· ' enable audio in
PhT············ CON···· $10···················· ' start of phonetic text
Help··········· CON···· $FE···················· ' display help
EOM············ CON···· $AA···················· ' end of message
OK············· CON···· $55··················· ' "okay" for hex mode
T2400·········· CON···· 1021
MAINIO
'LOW 4
'LOW 5··· 'Digital Display
'LOW 6
'LOW 8
'LOW 9
'LOW 10
'LOW 11
'LOW 12
'LOW 13
'LOW 14
'LOW 15
INPUT 4
OUTPUT 5
INPUT 6
INPUT 7
OUTPUT 8
OUTPUT 9
INPUT 10
OUTPUT 11
INPUT 12
INPUT 13
INPUT 14
OUTPUT 15
RecievedTransmitterData VAR Word 'Varible to hold Incoming Electrical codes
result VAR Byte
resultTwo VAR Byte
'
[noparse][[/noparse] Program Code ]
Main:
····GOTO Init
··· SERIN 4,1021, [noparse][[/noparse]RecievedTransmitterData]
··· DEBUG ? RecievedTransmitterData,CR
· '_________________________________________________________________________________________________________________________________
··· IF (RecievedTransmitterData = 49) THEN GOSUB Lights_On
··· IF (RecievedTransmitterData = 51) THEN GOSUB Lights_Off
··· IF (RecievedTransmitterData = 3) THEN GOSUB GroundFault
··· IF (RecievedTransmitterData = 4) THEN GOSUB ResetPumpSystem
··· IF (RecievedTransmitterData = 5) THEN GOSUB MainVoltageOffline
··· GOTO MAIN
·'__________________________________________________________________________________________________________________________________
··· Lights_On:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Welcome, I, am Angel. Shuler farms micro computer. All voltages and currents are, within design, limits.", EOM]
··· GOTO MAIN
· '__________________________________________________________________________________________________________________________________
··· Lights_Off:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Thankyou for stopping by, all systems are, operating correctly.", EOM]
··· GOTO MAIN
··· '_______________________________________________________________________________________________________________________________
··· Init:
··· SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATDT205-288-0936;", CR]
··· PAUSE 10000
··· SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATDT911", CR]
··· PAUSE 5000
··· SEROUT TX1, T2400, [noparse][[/noparse]"+++"]
··· PAUSE 2000
··· SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATH0", CR]
··· GOTO MAIN
··· '______________________________________________________________________________________________________________________________
··· Error:
··· DEBUG "The Error subroutine was called, Modem could not establish a connection ..."
··· PAUSE 1000
··· GOTO I_Modm ' try to initialize again
··· I_Modm: PAUSE 250 ' allow modem to power up
··· GOTO MAIN
·· '_______________________________________________________________________________________________________________________________
··· GroundFault:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Hello. All Systems are Operating Correctly!", EOM]
··· GOTO MAIN
··· ResetPumpSystem:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Good night John and Kevin!", EOM]
··· GOTO MAIN
··· MainVoltageOffline:
··· GOSUB Check_Busy
··· SEROUT Tx, Baud, [noparse][[/noparse]Say, "Attention. Main incoming primary voltage is off-line. I will restet contactors, when avalable!", EOM]
··· GOTO MAIN
'
[noparse][[/noparse] Subroutines ]
' Check status of Emic TTS module
' -- wait until Busy line released by Emic
' -- code as written does not timeout
Check_Busy:
· PAUSE 1
······································ ' allow busy to activate
· DO WHILE (Busy = Yes) : LOOP········ ' If Pin (2) is a Logical (1) then keep Looping
······································ ' When it goes "LOw" Return to Main
· RETURN
Comments
"205-288-0936;", then wait 10 seconds, then send the ascii string, "ATDT911", CR through to the whatever answers on the other end. (it will not dial 911-- are you really trying to dial that!?) Then it will wait 5 seconds, go back to offline mode, and then hang up (ATH0). That means it has already hung up the line before the subroutine returns to main, where it just repeats the process wihtout ever getting to the part of the code where it is supposed to send the status message. Maybe that is just part of your debuging strategy.
Are you saying the modem does pick up the line, but never dials the first number, 205-288-0936? How are you monitoring the phone line? You're sure the connections with the modem are okay (inverter like MAX232 in the circuit?)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
Http://www.parallax.com
Post Edited (Dave Andreae (Parallax)) : 10/13/2005 7:14:31 PM GMT