Discussion in "Project Help" started by    Deepakvaishu    Jan 11, 2017.
Wed Jan 11 2017, 10:47 AM
#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, 05:59 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, 11:58 AM
#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
Sat Jan 14 2017, 11:59 PM
#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, 12:00 AM ]
Mon Jan 16 2017, 06:07 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, 08:31 AM
#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, 01:12 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, 01:13 AM ]

Get Social

Information

Powered by e107 Forum System

Conversation

Mon Jan 16 2017, 03:15 PM
Rutuja
How can we read notepad file using random acess file
Fri Jan 06 2017, 06:18 AM
muhammad Umar
i need cd4047 library file for protious please help me i s
ExperimenterUK
Wed Jan 04 2017, 09:01 PM
@Emin what is your site user name ?
Tue Jan 03 2017, 11:16 PM
Emin
Emin: I'm already a member since 2012 and entered repeatedly during period. But now it is impossible and obtaining a new registration is also failed. The same error message specifying that two e-mails i entered are different!. In fact thaey are the same. Now, what will be happen, what is your solution? Thanks..
Tue Jan 03 2017, 11:15 PM
Emin
I'm already a member since 2012 and entered repeatedly during period. But now it is impossible and obtaining a new registration is also failed. The same error message specifying that two e-mails i entered are different!. In fact thaey are the same. Now, what will be happen, what is your solution? Thanks..
Sun Jan 01 2017, 03:14 PM
Manoranjana Chary
Write an embedded program of increment and decrement in LCD connected to two keys of int1 and int0. Can u please send me the code for this as fast as possible because i need to submit it in college kindly
ExperimenterUK
Sat Dec 31 2016, 06:28 PM
Happy New Year everyone
ExperimenterUK
Sat Dec 31 2016, 06:27 PM
Please post questions in the forum, the chat box is for chat
Thu Dec 29 2016, 07:47 AM
drashti ranolia
can anyone help me for the microcontroller 8051 programming code for street lights that glow on vehicle movement using IR sensors ?
Tue Dec 27 2016, 11:45 AM
Shubhangi
Do we have to write lookup table for d6t thermal sensor?

Downloads

Comments

jmunjr
Tue Jan 17 2017, 06:25 PM
sarfrosh92
Sun Jan 15 2017, 09:18 AM
Deepakvaishu
Wed Jan 11 2017, 10:25 AM
rana_jee773
Sat Dec 10 2016, 11:22 AM
[email protected]
Thu Dec 08 2016, 11:02 AM
Jonathan.kei
Mon Nov 21 2016, 04:30 PM
AVRuser1
Sun Nov 20 2016, 06:07 PM
JaguarPaw
Thu Nov 17 2016, 07:44 PM

Online

Guests: 20, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37797
Newest member: jmunjr
Forum Activity
jmunjr Avatar
Posted By jmunjr
Wed Jan 18 2017, 01:23 AM
Digital cameras have a viewfinder, had you conside...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jan 18 2017, 01:19 AM
Digital cameras have a viewfinder, had you conside...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jan 18 2017, 01:12 AM
Quotes can be tricky, but this should work.char *p...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jan 18 2017, 12:56 AM
Here is a new version that works on the circuit y...
jmunjr Avatar
Posted By jmunjr
Tue Jan 17 2017, 06:41 PM
Hi, I have been searching to find examples of a li...
Deepakvaishu Avatar
Posted By Deepakvaishu
Mon Jan 16 2017, 08:31 AM
you are right ..I should not include '\' at t...
Deepakvaishu Avatar
Posted By Deepakvaishu
Mon Jan 16 2017, 06:07 AM
No ,its not the null character, its just the '...
sankalp_s Avatar
Posted By sankalp_s
Sun Jan 15 2017, 07:55 PM
There is a fault in your Proteus design.If you loo...
sarfrosh92 Avatar
Posted By sarfrosh92
Sun Jan 15 2017, 10:04 AM
The 8051 Microcontroller (3rd Edition) by I. Scott...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Jan 14 2017, 11:59 PM
The site editor may have removed the 0 from \0.Actually it should not be needed, sochar *phone_no[3 ]={"1234567890" ," 9087654321" ,"76676667676"}; //array of pointers should work.