Discussion in "Project Help" started by    Deepakvaishu    Jan 11, 2017.
Wed Jan 11 2017, 04:17 pm
#1
How to send the same message to multiple contacts which are stored in an array of phone numbers, using AT commands for SIM900A gsm modem using 8051 microcontroller.
Should I make a loop?
But then how to pass the variable (array elemenst to AT command)?
Thanks in advance
Fri Jan 13 2017, 11:29 am
#2
You need to send AT command one by one to all the numbers in array. You can create a simple wrapper function to send sms where in you can pass mobile number and text to send. then call the function from a for loop.
 Deepakvaishu like this.
Fri Jan 13 2017, 05:28 pm
#3
suppose i have this array
char *phone_no[3 ]={"1234567890\" ," 9087654321\" ,"76676667676\"; //array of pointers

for(i=0;i<3;i++)
{
uart_string("AT+CMGF=1\r\n");
delay_ms(2000);
uart_string("AT+CMGS=\phone_no[i]\r\n");
delay_ms(2000);
uart_string("hello world\r\n");
delay_ms(2000);
uart_data(0X1A); //control+Z
delay_ms(2000);
}


will this work
Sun Jan 15 2017, 05:29 am
#4
The site editor may have removed the 0 from \0.
Actually it should not be needed, so
char *phone_no[3 ]={"1234567890" ," 9087654321" ,"76676667676"}; //array of pointers
should work.


[ Edited Sun Jan 15 2017, 05:30 am ]
Mon Jan 16 2017, 11:37 am
#5
No ,its not the null character, its just the '\',
have have read on the google "How to send the msg using AT commands and microcntroller" then the results which I got were,

uart_string("AT+CMGS=\"9999999999\"\r\n"); .......In this format we should code ,,hence i have added '\' as the last character n the array of phone numbers..

IS this wrong??

plz guide me with the correct format for sending the message using AT commands and controller.

Mon Jan 16 2017, 02:01 pm
#6
you are right ..I should not include '\' at the end of the phone number...
I came to know that we have used \" to print " character since we want ,
AT+CMGS="phone number"; " should be printed and hence we have used \".
Wed Jan 18 2017, 06:42 am
#7
Quotes can be tricky, but this should work.

char *phone_no[3 ]={"1234567890" ," 9087654321" ,"76676667676"}; //array of pointers

for(i=0;i<3;i++)
{
uart_string("AT+CMGF=1\r\n"); //probably not be needed each time
delay_ms(2000);
uart_string("AT+CMGS=\""); //open quotes
uart_string(phone_no[i]); //insert number
uart_string("\"\r\n"); //close quotes.. return
delay_ms(2000);
uart_string("hello world\r\n");
delay_ms(2000);
uart_data(0X1A); //control+Z
delay_ms(2000);
}

In a similar project I used \r not \r\n
I don't know if it makes a difference.


[ Edited Wed Jan 18 2017, 06:43 am ]
 Deepakvaishu like this.
Wed Jan 18 2017, 11:58 am
#8
Thank you....Now I can send the msg to multiple contacts...
But when i use a serial interrupt I can't send the message to any contact...
Is serial interrupt required for sending the message?

i am also using Rfid module here...
Once the rfid card is readed I have to send the message to the particular number..
Plz help...

Thu Jan 19 2017, 02:08 am
#9


But when i use a serial interrupt I can't send the message to any contact...
Is serial interrupt required for sending the message?

Deepakvaishu


You don't need to use the serial interrupt to send.
Most simple programs don't.
Your version of "uart_string()" might , but it's unlikely.
What are you using the serial interrupt for ?


i am also using Rfid module here...
Once the rfid card is readed I have to send the message to the particular number..

Deepakvaishu


You will have to give a lot more detail of the problem.
Thu Jan 19 2017, 10:20 am
#10
I am using serial interrupt for RFID card reader,whenever a RFID card is readed then we will get its ascii value (serial interrupt)....
Whenever the RFID card is readed then we should send the message to the specific number.

The problem which I am getting is that whenever I do the GSM and RFID(using serial interrupt code ) both separate , then they are working.

But when I combine both codes together for GSM and RFID ,both are not working..
Here using serial interrupt (for both transmiting(AT commands) and receiving (rfid card ascii value));

plz help.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Richardgar
Sat Apr 20 2024, 11:05 am
AntoniaRoons
Fri Apr 19 2024, 09:59 pm
carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am