View previous topic :: View next topic |
Author |
Message |
PrinceNai
Joined: 31 Oct 2016 Posts: 507 Location: Montenegro
|
|
Posted: Wed Nov 02, 2016 9:00 am |
|
|
benoitstjean wrote: | The reason is that some responses have the 'OK' embedded in them and others the 'OK arrives later, in some other cases you get 'OK' followed by another response. So there is no consistency between messages and it can get confusing.
|
Yeah, I found that one out when trying to figure out why "AT+CREG?" didn't work. I'm using state machine to decipher the answers from the modem and delayed "OK" as the answer to this command fooled my state machine into wrong state :-). |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Wed Nov 02, 2016 5:56 pm |
|
|
I've been doing sms/gsm projects for about 9 years.
I've never had an issue with my modems doing sms rapid fire... i do wait for the OK response though.
The code provided was meant as a starting point, not as a fool proof solution.
I mostly deal with Telit chips... and i guess it also depends what your definition of FAST is.
The receiver is almost never aware of when the others on the list get the sms.... so in all recipients eyes, they got the sms "instantly". _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 507 Location: Montenegro
|
|
Posted: Thu Nov 03, 2016 4:39 pm |
|
|
Dear sirs, success :-).
You really have done all the hard work, I just needed to punch in a couple of lines.
Code: |
// Send status SMS to all cell phone numbers stored in EEPROM
void Send_Status_To_All(){
int8 Offset = 0;
ComposeMessage(SMS_Message);
for (Offset = 0; Offset < 32; Offset = Offset +16){
EEPROM_GET(GSM_NUMBER,16,Offset);
Send_Msg(SMS_Message);
}
Offset = 0;
}
|
and
Code: |
// Send SMS
void Send_Msg(char* Msg){
fprintf(GSM,"AT+CMGS=\"%s\"\r\n",GSM_NUMBER);
Wait_response(GSM_Ready_To_Receive_Message); // wait for "> "
GSM_Send(Msg);
// Wait_response(GSM_OK);
Wait_response(SMS_SENT); // wait for "+CMGS"
}
|
Thank you all very much.
Btw, AT+CMGSO command doesn't work on SIM900. |
|
|
benoitstjean
Joined: 30 Oct 2007 Posts: 568 Location: Ottawa, Ontario, Canada
|
|
Posted: Thu Nov 03, 2016 4:52 pm |
|
|
True, I just looked at the docs and AT+CMGSO does not work on SIM900. But I did confirm with SIMCom and you _must_ wait for +CMGS response after sending otherwise, you may end-up with errors. The modem can only queue 2 SMS I think. But the best practice is to wait for +CMGS.
Good work and good luck.
Ben |
|
|
lahcen
Joined: 17 Jan 2022 Posts: 1 Location: Morocco
|
|
Posted: Mon Jan 17, 2022 9:52 am |
|
|
Hi PrinceNai I have same project, Thanks |
|
|
|