Tobias Simonsen
New Member
Hi,
Using a SIM800L GSM module connected to a 08M2 chip.
Everything is connected and works as it should.
I can send SMS from the setup, no problems.
I can receive SMS, but I can not get the information out of the SMS.
The setup is connected to a Hyperterminal on my computer, so I can see what is going on.
I can see the SMS is received in the Hyperterminal. It is a long string in one line (including sender number, date, time ect.), and the next line contain the SMS text.
I need that text, to be used in the code, so eg. when I send "1" (the number one), my code should check for this "1", and if it is correct then jump to another place in the code.
Below is the start of my code:
pause 500
serout c.1,T2400,("AT+CMGD=1",CR)
pause 2000
serout c.1,T2400,("AT+CMGF=1",CR)
pause 2000
serout c.1,T2400,("AT+CSCA=",$22,"+4540590000",$22,CR)
pause 200
serin c.4,T2400,("+CMTI:")
pause 200
main:
if pinc.3 = 1 then sendsms
serout c.1,T2400,("AT+CMGL=",$22,"ALL",$22,CR)
serin c.4,T2400,("+CMGL")
serin c.4,T2400,(LF)
serin c.4,T2400,W0
if W0="1" then switch_on
goto delete
_________________________________
It is in the main program I have the problem, I think.
The AT+CMGL=ALL command list all the SMS which is received by the GSM module.
The +CMGL command is waiting for +CMGL to be shown before it goes on. Then I made a Line Feed, I then the first letter/number in the second line should be put into the W0 register, and if W0=1 then jump to "switch_on".
The Hyperterminal shows:
AT+CMGL="ALL"
+CMGL: 1,"REC UNREAD","+4520730587","","17/02/11,08:18:55+04"
1
How do I get the 1 into the W0 register?
I think I am missing an AT command or what do I do wrong?
Thanks a lot for your help.
Using a SIM800L GSM module connected to a 08M2 chip.
Everything is connected and works as it should.
I can send SMS from the setup, no problems.
I can receive SMS, but I can not get the information out of the SMS.
The setup is connected to a Hyperterminal on my computer, so I can see what is going on.
I can see the SMS is received in the Hyperterminal. It is a long string in one line (including sender number, date, time ect.), and the next line contain the SMS text.
I need that text, to be used in the code, so eg. when I send "1" (the number one), my code should check for this "1", and if it is correct then jump to another place in the code.
Below is the start of my code:
pause 500
serout c.1,T2400,("AT+CMGD=1",CR)
pause 2000
serout c.1,T2400,("AT+CMGF=1",CR)
pause 2000
serout c.1,T2400,("AT+CSCA=",$22,"+4540590000",$22,CR)
pause 200
serin c.4,T2400,("+CMTI:")
pause 200
main:
if pinc.3 = 1 then sendsms
serout c.1,T2400,("AT+CMGL=",$22,"ALL",$22,CR)
serin c.4,T2400,("+CMGL")
serin c.4,T2400,(LF)
serin c.4,T2400,W0
if W0="1" then switch_on
goto delete
_________________________________
It is in the main program I have the problem, I think.
The AT+CMGL=ALL command list all the SMS which is received by the GSM module.
The +CMGL command is waiting for +CMGL to be shown before it goes on. Then I made a Line Feed, I then the first letter/number in the second line should be put into the W0 register, and if W0=1 then jump to "switch_on".
The Hyperterminal shows:
AT+CMGL="ALL"
+CMGL: 1,"REC UNREAD","+4520730587","","17/02/11,08:18:55+04"
1
How do I get the 1 into the W0 register?
I think I am missing an AT command or what do I do wrong?
Thanks a lot for your help.