PVJohn
01-14-2006, 12:08 PM
Hello,·I would like·to read SMS from my cell phone and print it in debug window, but I couldn't find any good example. I don't know what's in the message and how long it is, so·I can't use [WAIT ("anything")] to·search for the string and I must be able to read 160 characters. I'm using BS2px at 2400. This is my code to send·SMS out.
'{$STAMP BS2px}
'{$PBASIC 2.5}
'
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
· RXfromModem·· CON···· 0··· ' receive (from modem)
· TXtoModem······ CON···· 1··· ' transmit (to modem)
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
· Baud···· CON···· 1646····· ' 2400-N-8-1
· ControlZ CON···· 26······· ' Escape character·
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
· GOSUB SendText
· STOP
' ------------------------------------------------------------------------------
' Subroutines
' ------------------------------------------------------------------------------
SendText:
· DEBUG "Setting receiving number",CR,LF
· SEROUT TXtoModem, Baud, ["AT+CMGS=",34,"+15128318653",34,CR]
· SERIN RXfromModem, Baud, [WAIT (">")]
·
· SEROUT TXtoModem, Baud, ["My message.",CR]
· SEROUT TXtoModem, Baud, [ControlZ,CR]
· DEBUG "sent ctrl-z",CR,LF
· SERIN RXfromModem, Baud, [WAIT ("OK")]
· DEBUG "Got OK from modem",CR,LF
· DEBUG "Message has been send",CR,LF
RETURN
Thanks for your help.
PVJohn
'{$STAMP BS2px}
'{$PBASIC 2.5}
'
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
· RXfromModem·· CON···· 0··· ' receive (from modem)
· TXtoModem······ CON···· 1··· ' transmit (to modem)
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
· Baud···· CON···· 1646····· ' 2400-N-8-1
· ControlZ CON···· 26······· ' Escape character·
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
· GOSUB SendText
· STOP
' ------------------------------------------------------------------------------
' Subroutines
' ------------------------------------------------------------------------------
SendText:
· DEBUG "Setting receiving number",CR,LF
· SEROUT TXtoModem, Baud, ["AT+CMGS=",34,"+15128318653",34,CR]
· SERIN RXfromModem, Baud, [WAIT (">")]
·
· SEROUT TXtoModem, Baud, ["My message.",CR]
· SEROUT TXtoModem, Baud, [ControlZ,CR]
· DEBUG "sent ctrl-z",CR,LF
· SERIN RXfromModem, Baud, [WAIT ("OK")]
· DEBUG "Got OK from modem",CR,LF
· DEBUG "Message has been send",CR,LF
RETURN
Thanks for your help.
PVJohn