Shop OBEX P1 Docs P2 Docs Learn Events
Cermetek to Cermetek communication — Parallax Forums

Cermetek to Cermetek communication

william bergerwilliam berger Posts: 3
edited 2006-03-24 02:51 in BASIC Stamp
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

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-23 05:10
    William,

    ·· 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
  • william bergerwilliam berger Posts: 3
    edited 2006-03-23 15:36
    Hi -

    Thanks. Yes, I can dial out of both modems.

    wb
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-23 17:22
    At first I didn't realize you had two codes posted (again, this is why you should attach them)...So my question is, what is happening with the receive unit?· Is the phone ringing on its end?· Is it detecting the ring and answering?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • william bergerwilliam berger Posts: 3
    edited 2006-03-23 23:30
    Ah, yes... No, the second cermetek is not answering, it isn't detecting the incoming ring.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-24 02:51
    Perhaps you should try switching roles...swap the codes and have the unit originating now answer and the anwering unit not originate.· See if it works the other way.· I don't have a convenient way to test your code since I don't have two phone lines available, but I would suggest even with a standard phone trying to call the unit which is supposed to answer and see if it even tries to answer.· If not I would look at the settings for auto answer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.