Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

urgent I can not send sms from mcu and gsm modem to moblie???

Status
Not open for further replies.

Ni yanfang

Member level 3
Joined
Jul 30, 2013
Messages
59
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
432
Hi I am using AT89C51 mcu connect with gsm modem . I need to write AT command using c language to run my program. But the code is not working and can not send sms to mobile. Kindly che check for me the below code. I just need press p1^3 button then the prgram can send sms. I did not need receive reply because i did not connect LCD. And i have not ideal how to add LED p3^6 in this program to indicate on and off. This means led on when sending sms or led off when device is not sending sms. Kindly help please.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <reg51.h>              
#include <stdio.h>              
sbit irout=P1^3;
sbit rs=P2^0;
sbit rw=P2^1;
sbit e=P2^2;
void serial_init(void);
void delay(int);
void serial_init(void)
{
   SCON = 0x50;                 
   TMOD = 0x20;             
   TH1   = 0xFD;         
   TR1   = 1;               
   TI   = 1;                
}
void serial(void) interrupt 4
{
unsigned int y[25];
if(RI==1)
{
y[25]=SBUF;
RI=0;
}
}
void delay(int n)
{
   int i,j;
   for(i=0;i<n;i++)
   for(j=0;j<1000;j++);
}
void main(void)
{
IE=0x90;
irout=1;
irout=0;           
while(1)
{       if(irout==1)
{
        delay(200); 
        serial_init();                                                                                            
        printf("AT+CMGF=1%c",13);                                        
        delay(200);            
        printf("AT+CMGS=\"92207869\"%c",13);
        delay(200);           
        printf("Hi :-) GSM Modem Test");                     
        delay(20); 
        printf("%c",0x1A);                                                             
        delay(200); 
        while(irout==1);
 } 
}}

 
Last edited by a moderator:

Hello there,

Try these links

**broken link removed**

**broken link removed**

**broken link removed**

**broken link removed**

Best regards,

- - - Updated - - -

void main(void)
{
IE=0x90;
irout=1;
irout=0;
while(1)
{ if(irout==1)
{
delay(200);
serial_init();
printf("AT+CMGF=1%c",13);
delay(200);
}

Try,

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void main(void)
{
IE=0x90;
irout=1;
irout=0; 
[B]serial_init(); [/B]
 
while(1)
{ if(irout==1)
{
delay(200); 
printf("AT+CMGF=1%c",13); 
delay(200); 
}

 
Last edited by a moderator:

Hello there,

Try these links

**broken link removed**

**broken link removed**

**broken link removed**

**broken link removed**

Best regards,

- - - Updated - - -


}

Try,

void main(void)
{
IE=0x90;
irout=1;
irout=0;
serial_init();

while(1)
{ if(irout==1)
{
delay(200);
printf("AT+CMGF=1%c",13);
delay(200);
}

I try already. but still can not send sms. do you have any ideal?
 

Hello there,

nd i have not ideal how to add LED p3^6 in this program to indicate on and off. This means led on when sending sms or led off when device is not sending sms.

Code:
sbit Led1=P3^6;// P3.6 in become GPIO.(add after #include)

Led1=1;// led become high

led1=0;// led become low.

use above logic and update your code.

I try already. but still can not send sms. do you have any ideal?

Have tried with Hyperterminal?? Please connect the gsm module with your PC hyper terminal and try.

Are you sure about your hardware connection ?? please verify once again (mainly TX(GSM)--> RX(MCU)).

update me
 

Attachments

  • Interface GSM Module with 8051 microcontroller (AT89C51) using PC circuit.gif
    Interface GSM Module with 8051 microcontroller (AT89C51) using PC circuit.gif
    8.9 KB · Views: 46
Last edited by a moderator:

Try connecting your GSM modem with the PC and you can try the AT commands through hyperterminal.
Also the sending of message format inlcudes country code to be specified along with the no. check that too. use +1 (if in USA), likewise..
After it is verifed then check on the board.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top