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.

[51] SMS receiving through sim300 with 8051

Status
Not open for further replies.

Sudhp

Member level 4
Member level 4
Joined
Oct 11, 2013
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Location
India
Visit site
Activity points
528
HI,
I am trying to read msg from gsm modem, Sometimes it happens bt sometimes i m unable to read msg,it is giving a junk value on lcd.

I m using below codes to read msg from modem. I have downloaded these codes from net can u guys please help me by providing me mistakes in these codes. So i read msg properly.

PHP:
void main (void)
{
rw=0;
clear();
init();
lcd_init();

SMSString("AT\r"); // AT commands to initialize gsm modem
delay_sms(1000);

SMSString( "ATe0\r"); // turn off echo
delay_sms(1000);

SMSString( "AT&W\r"); // save settings
delay_sms(1000);

SMSString( "AT+CMGF=1\r"); // select text mode for sms
delay_sms(1000);

SMSString( "AT+CNMI=2,2,0,0,0\r"); // notification of new sms
delay_sms(1000);

SMSString( "AT+CMGR=1\r"); // AT command to read sms

IE=0X90;   // Enable serial interrupt
delay_sms(5000);



// read sms and store in buffer msg1

read_text(msg1,rec_no,time_date);
clear();
IE=0X00;     // Disable all interrupt
while(1);
}
void read_text( unsigned char *msg,unsigned char *no ,unsigned char *time)
{
unsigned char *temp;
temp=msg;
do
msg++;
while(*msg!='+');        
do
msg++;
while(*msg!='+');         //  reaching at no
do
*no++=*msg++;
while(*msg!='"');         // reaching at time
*no++='\0';
msg++;
msg++;
msg++;
do
*time++=*msg++;
while(*msg!='+');         // raching at message
*time='\0';
do
msg++;
while(*msg!='\n');
msg++;
do
*temp++=*msg++;
while(*msg!='\r');       // reaching at end of message
*temp='\0';

lcd_cmd(0x80);            // ist line address
lcd_str(rec_no);          // array having receipt no
lcd_cmd(0xc0);            // 2nd line address
lcd_str(msg1);            // array having message
}
 

can anybody tell me that why this command is used?
AT+CNMI=2,2,0,0,0\r
And what these no. 2,2,0,0,1 stands for...........

How can the msgs be deleted position-vise ?
And on deleting the msgs by at command the other msgs shifts there position or not ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top