Cermetek to Cermetek communication
Hi all –
I have successfully had the cermetek call and page a cell phone. What I would like to do now is have the cermetek/bs2-homework board call and then transfer a small amount of information to another cermetek/bs2-homework board, and I am not having any success with receiving a call and subsequent data.
Any help would be greatly appreciated.
Here are the codes I am using:
Call:
'
[noparse][[/noparse] I/O Definitions ]
'
Red_LED CON 0 ' red LED
Yellow_LED CON 1 ' yellow LED
RI_ VAR IN12 ' ring indicator
DCD_ VAR IN13 ' carrier detect
RX1 CON 14 ' CH1786 "Rx" pin
TX1 CON 15 ' CH1786 "Tx" pin
'
[noparse][[/noparse] Constants ]
'
T2400 CON 396 ' 2400 baud for modem: 8N
No CON 1
Yes CON 0
FF CON 12 ' clear screen
'
[noparse][[/noparse] Variables ]
'
InByte VAR Byte ' input character from modem
'
[noparse][[/noparse] Initialization ]
'
DIRS = %100000000000011
'
[noparse][[/noparse] Main Code ]
'
Main:
GOSUB Initialize_Modem ' initialize modem
GOTO main
'
[noparse][[/noparse] Subroutines ]
'
Initialize_Modem:
PAUSE 1000
TOGGLE 1 ' allow modem to power up
SEROUT TX1, T2400,[noparse][[/noparse]"AT", CR] ' setup modem for speed
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 2500
Dial:
TOGGLE 1
PAUSE 250
TOGGLE 1
SEROUT TX1, T2400,[noparse][[/noparse]"ATD1-xxx-xxx-xxxx", CR]
PAUSE 5000
TOGGLE 1
PAUSE 250
TOGGLE 1
PAUSE 250
TOGGLE 1
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"c", CR]
PAUSE 5000
SEROUT TX1, T2400,[noparse][[/noparse]"ATHO", CR]
PAUSE 7000
RETURN
Error:
TOGGLE 0 'Light indicates failed connection
PAUSE 250
TOGGLE 0 'Light indicates failed connection
PAUSE 250
TOGGLE 0 'Light indicates failed connection
PAUSE 250
RETURN
Receive:
'
[noparse][[/noparse] I/O Definitions ]
'
Red_LED CON 0 ' red LED
Yellow_LED CON 1 ' yellow LED
RI_ VAR IN12 ' ring indicator
DCD_ VAR IN13 ' carrier detect
RX1 CON 14 ' CH1786 "Rx" pin
TX1 CON 15 ' CH1786 "Tx" pin
'
[noparse][[/noparse] Constants ]
'
T2400 CON 396 ' 2400 baud for modem: 8N
No CON 1
Yes CON 0
FF CON 12 ' clear screen
'
[noparse][[/noparse] Variables ]
'
InByte VAR Byte ' input character from modem
'
[noparse][[/noparse] Initialization ]
'
DIRS = %100000000000011
'
[noparse][[/noparse] Main Code ]
'
Main:
InByte = 0
GOSUB Initialize_Modem ' initialize modem
GOTO main
'
[noparse][[/noparse] Subroutines ]
'
Initialize_Modem:
TOGGLE 0
PAUSE 1000 ' allow modem to power up
SEROUT TX1, T2400,[noparse][[/noparse]"AT", CR] ' setup modem for speed
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"ATS0=2", CR] ' answer on second ring.
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"ATS7=50", CR] ' max carrier detect is 50 secs
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"AT&C1", CR] ' enable DCD
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
PAUSE 600
Wait_DCD: ' wait for carrier detect: DCD goes low when connected
TOGGLE 1
PAUSE 250
IF DCD_ = 0 THEN Connect ' wait for carrier
GOTO Wait_DCD
Connect:
TOGGLE 0
PAUSE 1000
Communicate:
SERIN RX1, T2400,[noparse][[/noparse]InByte]
IF InByte = a THEN Hang_up
IF InByte = b THEN Toggle_red
IF InByte = c THEN Toggle_yellow
GOTO Communicate
Hang_up: ' hang up modem
OUTL=%0000 ' LEDs off
SEROUT TX1, T2400,[noparse][[/noparse]CR,LF,LF,"Disconnect requested", CR,LF]
PAUSE 2000
SEROUT TX1, T2400, [noparse][[/noparse]"+++"]
PAUSE 2000
SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATH0", CR]
GOTO wait_DCD
Toggle_red:
TOGGLE 0
Pause 250
GOTO Communicate
Toggle_yellow:
TOGGLE 2
PAUSE 500
TOGGLE 2
PAUSE 500
TOGGLE 2
PAUSE 500
TOGGLE 2
PAUSE 500
GOTO Communicate
Error:
TOGGLE 0 'Light indicates failed connection
PAUSE 250
TOGGLE 0
PAUSE 250
TOGGLE 0
PAUSE 250
TOGGLE 0
PAUSE 250
RETURN
Thanks,
William Berger
I have successfully had the cermetek call and page a cell phone. What I would like to do now is have the cermetek/bs2-homework board call and then transfer a small amount of information to another cermetek/bs2-homework board, and I am not having any success with receiving a call and subsequent data.
Any help would be greatly appreciated.
Here are the codes I am using:
Call:
'
[noparse][[/noparse] I/O Definitions ]
'
Red_LED CON 0 ' red LED
Yellow_LED CON 1 ' yellow LED
RI_ VAR IN12 ' ring indicator
DCD_ VAR IN13 ' carrier detect
RX1 CON 14 ' CH1786 "Rx" pin
TX1 CON 15 ' CH1786 "Tx" pin
'
[noparse][[/noparse] Constants ]
'
T2400 CON 396 ' 2400 baud for modem: 8N
No CON 1
Yes CON 0
FF CON 12 ' clear screen
'
[noparse][[/noparse] Variables ]
'
InByte VAR Byte ' input character from modem
'
[noparse][[/noparse] Initialization ]
'
DIRS = %100000000000011
'
[noparse][[/noparse] Main Code ]
'
Main:
GOSUB Initialize_Modem ' initialize modem
GOTO main
'
[noparse][[/noparse] Subroutines ]
'
Initialize_Modem:
PAUSE 1000
TOGGLE 1 ' allow modem to power up
SEROUT TX1, T2400,[noparse][[/noparse]"AT", CR] ' setup modem for speed
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 2500
Dial:
TOGGLE 1
PAUSE 250
TOGGLE 1
SEROUT TX1, T2400,[noparse][[/noparse]"ATD1-xxx-xxx-xxxx", CR]
PAUSE 5000
TOGGLE 1
PAUSE 250
TOGGLE 1
PAUSE 250
TOGGLE 1
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"c", CR]
PAUSE 5000
SEROUT TX1, T2400,[noparse][[/noparse]"ATHO", CR]
PAUSE 7000
RETURN
Error:
TOGGLE 0 'Light indicates failed connection
PAUSE 250
TOGGLE 0 'Light indicates failed connection
PAUSE 250
TOGGLE 0 'Light indicates failed connection
PAUSE 250
RETURN
Receive:
'
[noparse][[/noparse] I/O Definitions ]
'
Red_LED CON 0 ' red LED
Yellow_LED CON 1 ' yellow LED
RI_ VAR IN12 ' ring indicator
DCD_ VAR IN13 ' carrier detect
RX1 CON 14 ' CH1786 "Rx" pin
TX1 CON 15 ' CH1786 "Tx" pin
'
[noparse][[/noparse] Constants ]
'
T2400 CON 396 ' 2400 baud for modem: 8N
No CON 1
Yes CON 0
FF CON 12 ' clear screen
'
[noparse][[/noparse] Variables ]
'
InByte VAR Byte ' input character from modem
'
[noparse][[/noparse] Initialization ]
'
DIRS = %100000000000011
'
[noparse][[/noparse] Main Code ]
'
Main:
InByte = 0
GOSUB Initialize_Modem ' initialize modem
GOTO main
'
[noparse][[/noparse] Subroutines ]
'
Initialize_Modem:
TOGGLE 0
PAUSE 1000 ' allow modem to power up
SEROUT TX1, T2400,[noparse][[/noparse]"AT", CR] ' setup modem for speed
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"ATS0=2", CR] ' answer on second ring.
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"ATS7=50", CR] ' max carrier detect is 50 secs
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
SEROUT TX1, T2400,[noparse][[/noparse]"AT&C1", CR] ' enable DCD
SERIN RX1, T2400, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
PAUSE 250
PAUSE 600
Wait_DCD: ' wait for carrier detect: DCD goes low when connected
TOGGLE 1
PAUSE 250
IF DCD_ = 0 THEN Connect ' wait for carrier
GOTO Wait_DCD
Connect:
TOGGLE 0
PAUSE 1000
Communicate:
SERIN RX1, T2400,[noparse][[/noparse]InByte]
IF InByte = a THEN Hang_up
IF InByte = b THEN Toggle_red
IF InByte = c THEN Toggle_yellow
GOTO Communicate
Hang_up: ' hang up modem
OUTL=%0000 ' LEDs off
SEROUT TX1, T2400,[noparse][[/noparse]CR,LF,LF,"Disconnect requested", CR,LF]
PAUSE 2000
SEROUT TX1, T2400, [noparse][[/noparse]"+++"]
PAUSE 2000
SEROUT TX1, T2400, 10, [noparse][[/noparse]"ATH0", CR]
GOTO wait_DCD
Toggle_red:
TOGGLE 0
Pause 250
GOTO Communicate
Toggle_yellow:
TOGGLE 2
PAUSE 500
TOGGLE 2
PAUSE 500
TOGGLE 2
PAUSE 500
TOGGLE 2
PAUSE 500
GOTO Communicate
Error:
TOGGLE 0 'Light indicates failed connection
PAUSE 250
TOGGLE 0
PAUSE 250
TOGGLE 0
PAUSE 250
TOGGLE 0
PAUSE 250
RETURN
Thanks,
William Berger
Comments
·· In the future you should attach code of that length.· It's easier to look at it when the formatting is intact and you can easily load it into the BASIC Stamp Editor.· Are you able to dial out of both modems?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks. Yes, I can dial out of both modems.
wb
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com