8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
agnostos
Thu May 15 2008, 11:04PM
 User Offline
Registered Member #7875
Joined: Thu May 15 2008, 10:50PM

Posts: 3
Thanked 0 times in 0 posts
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....

Back to top


shyam
Fri May 16 2008, 02:54AM

 User Offline

Registered Member #2984
Joined: Mon Aug 06 2007, 11:33AM

Posts: 710
Thanked 104 times in 100 posts
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


CODE:

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

CODE:

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


lProgress is not made by early risers or hard workers, but by LAZY people, trying to find easier ways to do the same........
Back to top


agnostos
Sat May 17 2008, 02:48AM
 User Offline
Registered Member #7875
Joined: Thu May 15 2008, 10:50PM

Posts: 3
Thanked 0 times in 0 posts
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...
Back to top


agnostos
Sat May 17 2008, 03:08AM
 User Offline
Registered Member #7875
Joined: Thu May 15 2008, 10:50PM

Posts: 3
Thanked 0 times in 0 posts
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???
Back to top


sashijoseph
Sat May 17 2008, 05:31PM

 User Offline
Registered Member #5870
Joined: Mon Feb 04 2008, 06:26PM

Posts: 501
Thanked 114 times in 107 posts
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......



Let there be music........
Back to top


shyam
Sat May 17 2008, 09:37PM

 User Offline

Registered Member #2984
Joined: Mon Aug 06 2007, 11:33AM

Posts: 710
Thanked 104 times in 100 posts
u said that the mesaage is NULL...


does that mean u not recving message ?? or u recving msg with nothing to display??


lProgress is not made by early risers or hard workers, but by LAZY people, trying to find easier ways to do the same........
Back to top


trinadha
Sat Aug 09 2008, 06:01AM
 User Offline
Registered Member #9699
Joined: Sat Aug 09 2008, 05:49AM

Posts: 1
Thanked 0 times in 0 post
guys can u tell me how to recive area notification of gsm area onto a microprocessor
Back to top


Shailesh NAYAK
Tue Aug 12 2008, 11:11PM

 User Offline
Registered Member #2498
Joined: Mon Jul 23 2007, 01:20AM

Posts: 39
Thanked 9 times in 7 posts
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.).

Best Regards

Shailesh S. NAYAK
Back to top


 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems