Discussion in "Embedded GSM Development" started by    agnostos    May 16, 2008.
Fri May 16 2008, 11:34 am
#1
hello i am a student and i have a project to do with stk500 and gsm modem (siemens mc35).
i have connected the gsm modem with avr. i use printf to send a message and work perfectly but when i use scanf to read from gsm modem nothing happend why???
for example if i run this code
while(1)
{
printf("AT \r\n");
delay_ms(10);
/*Waiting for the response*/
scanf("%s", myData);
PORTB.0 = 1;
delay_ms(1000);
printf("at+cmgs=6938699188");
putchar( CR ); //CR
putchar( LF ); //LF
delay_ms(1000);
printf("%s",myData);
putchar(CTRLZ);
delay_ms(1000);
// if (myData[0] == 'O')
PORTB.0 = 0;
break;
}

i get message writing "AT" but this isn't write i must get "OK".
what must i change to read from gsm modem correct???
please help me time pressure me i have to finish my project until this Monday.
thanks....
Fri May 16 2008, 03:24 pm
#2
u will have to stop the echo first
"ATE0\r\n"


now if using scanf(), why r u using delay_ms(10) ??
no need at all..
and the syntax for sms should be ( i think)
at+cmgs="6938699188"
please confirm by connecting modem directly to PC via hyperterminal and verify both the commands
1.at+cmgs=6938699188
2.at+cmgs="6938699188"

considering the first command works then=>try modifying the code like this


printf("ATE0\r\n");
while(1)
{
printf("AT \r\n");


scanf("%s", myData);
PORTB.0 = 1;

printf("at+cmgs=6938699188\r\n");

printf("%s\r",myData);
putchar(CTRLZ);
delay_ms(1000);
// if (myData[0] == 'O')
PORTB.0 = 0;
break;
}


now if first command does not works then try the second and modify the code as

printf("ATE0\r\n");
while(1)
{
printf("AT \r\n");


scanf("%s", myData);
PORTB.0 = 1;

printf("at+cmgs=\"6938699188\"\r\n");

printf("%s\r",myData);
putchar(CTRLZ);
delay_ms(1000);
// if (myData[0] == 'O')
PORTB.0 = 0;
break;
}



u see most of the time scanf itself waits until it receives "\r" so u need not wait...

check and let us know if it works..
till then
:bye
Sat May 17 2008, 03:18 pm
#3
the gsm modem doesn't accept the \" it works with out that. i try your code but i have the same problems the message is null. why???
please help me time pressure me and i don't know what to do...
Sat May 17 2008, 03:38 pm
#4
i am afraid that my connection is error. i bought a null modem cable. and it is female in both sides. and i connect null modem. with this way
null modem - avr
2 -------> 3
3 -------> 2
5 -------> 5
i do the same from other side (null modem with gsm modem)
is my connection good???
Sun May 18 2008, 06:01 am
#5
See,what you need to do is connect Tx of modem to Rx of AVR and Rx of modem to Tx of AVR.(and both their grounds as well)
Check your null modem cable.....if pin2,pin3 at one end is connected to pin3,pin2 at the other end,then this is how you connect......

Sun May 18 2008, 10:07 am
#6
u said that the mesaage is NULL...


:mad :mad :mad does that mean u not recving message ?? or u recving msg with nothing to display??
Sat Aug 09 2008, 06:31 pm
#7
guys can u tell me how to recive area notification of gsm area onto a microprocessor
Wed Aug 13 2008, 11:41 am
#8
Hi,
receiving SMS will give first unsolicited SM indication with message index no.
first use AT+CNMI=2,1,0,0,0 which will give you unsolicited indication AT+CMTI: "SM",1
with message no. index.
as you receive this, use AT+CMGR=1 ( 1 is nothing but an Index no.).

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

MnoioCoove
Tue May 21 2024, 02:06 am
PedroDug
Sun May 19 2024, 05:39 pm
JewelAmuck
Sun May 19 2024, 03:06 pm
Minniemus
Sun May 19 2024, 07:39 am
Andyhet
Sat May 18 2024, 07:28 am
BrettTibre
Fri May 17 2024, 06:14 pm
Gordonfax
Fri May 17 2024, 10:28 am
Davidspils
Fri May 17 2024, 10:19 am