@ Bulman
I still can’t understand some of your ideas,
therefore I rewrote your program in a way that I think it should be.
--> My code example is a working program, have you given it a try?
I wrote my questions like comments next to the lines which I can’t get. So could you please take a look and answer the questions.
And do you think that this program could be used with all Nokia phones with embedded modems, or it’s for the 62xx series only?
--> I have tested it on 62xx and 63xx series,
--> according to the NOKIA documentation
--> it should work on any model with embedded modem.
--------------------------------------
DEFINE OSC 20
DEFINE HSER_TXSTA 24h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 115200
--> I couldn't establish a reliable connection to the phone faster than 9600
--> and 9600 is certainly fast enough to transfer those few bytes
DEFINE HSER_CLROERR 1
GSMbuffer var Byte [12]
Caller var Byte [12]
GSMtime var Byte [17]
‘Check the connection between the phone and PIC works. Should ‘give OK. Instead you’ve used ATZ, why?
--> You are right, a simple AT would do the same job at this point
Hserout [“AT”, 13, 10]
Pause 1000
HSerout ["AT+CMGF=1", 13, 10] 'Set Text Mode. Answer: OK
Pause 500
Hserout [“AT+CMGS=”, 34, “+359888123456”, 34, 13, 10] ‘Answer: >
‘Why have you put “,129” in addition. I think it’s not nessesary.
--> "129" is the "TYPE" (See NOKIA AT COMMANDS)
Pause 500
Hserout [“Test-message”, 13, 10]
‘Terminate the SMS by Control+Z
‘Here you send ASCII 26 => SUB. Is it equal with CTRL+Z?
Hserout [26]
--> ASCII 26 is equal to CTRL+Z
‘Answer: +CMGS: 125 - the ord. number of the SMS (0-‘255)
Pause 500
' Check for new incomming Messages
HSerout ["AT", 13, 10] ‘Check the connection
Pause 1000
HSerout ["AT+CMGF=1", 13, 10]
Pause 1000
Loop:
‘list new unread messages
Hserout [“AT+CMGL=”, 34, “REC UNREAD”, 34, 13, 10]
--> Lists all unread (new) messages
‘Optionally: "REC READ", "ALL"
--> I'm only interested in new "UNREAD" messages
--> already processed MSGs have been deleted
‘Or it must be HSerout ["AT+CMGL",13,10] ?
‘Answer in 3 lines should look like this:
‘+CMGL: 1,"REC UNREAD","+359888123456",,"04/07/21,08:03:05-00"
‘Test-message
‘OK
HSerin 5000, Loop, [Wait("UNREAD"), skip 3, STR Caller\12, skip 4, STR GSMTime\17, skip 4, STR GSMbuffer\12]
‘You ‘ve written skip 6 before STR GSMuffer\12 but I think it ‘should 'be skip 4?
--> There are two additional bytes to be skipped at the end of the first line (CR LF)
Then you used GSMBUFFER\16\13, which must be 'GSMbuffer\12. Am I right?
--> I did want to read the first 16 chars of the received message, --> GSMbuffer\16
What \16\13 does mean?
--> See PBP Manual Section 5.30
--> stop reading if chr(13) is received if no chr(13) read max 16 chars
' --- Put your code to output the result here
' i.e. LCDOUT . . . .
‘Delete the processed SMS:
Hserout [“AT+CMGD=1”, 13, 10]
--> This is exactly what I would do after the MSG has been processed
Goto Loop
--------------------------------------
regards
Bookmarks