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.

GSM Message Read Problem

Status
Not open for further replies.

arunbharathi.arasu

Full Member level 2
Joined
Feb 28, 2013
Messages
134
Helped
7
Reputation
14
Reaction score
6
Trophy points
1,298
Location
Chennai, Tamil Nadu, India
Activity points
2,151
Dear all,

I facing problem while read message.

when i read msg some letters are missing.

+CMGR:"REC UNREAD","+918754449444","",""17/08/17,15:48:23"
Hi, this is message

The above is the message format and message what i get from GSM.
shows in Terminal.

but when i read this i got

+CMGR:"REC UNREAD","+918754449444","",""17/08/17,154823"
Hthi is mssg

Like this. letters are missing form time..
body of the message also missing.

I have checked by sending the data what i received.
 

Hello Arun,

I understand that the GSM module works as expected. But it is on the microcontroller side that you are missing some characters.
1. Assuming you are using a microcontroller, what microcontroller are you using?
2. How are you handling UART receive? via. interrupt or by polling?
3. How do you handle the received characters? That is, can you explain how you receive the characters and buffer it to your array?

Regards,
Raj Gunaseelan James
 

Dear Raj Gunaseelan ,

problem solved. thanks.

- - - Updated - - -

hi,

Now i can read first message properly.

But i cannot read second message.

- - - Updated - - -
main program inside while

Code:
while(1)    {
    if(msgflag==1)
    {
     MSG_READ();
     count=0;
    delay(1000);
    msgflag=0;
    }
}
My interrupt code is
Code:
unsigned char *ok="OK",*error="ERROR",*newmsg="+CMTI: "SM",1";
Code:
void interrupt uart_ISR()
{      
    if(RCIF==1)
    {
       Rx_data=RCREG;
       RCIF=0;
       if(Rx_data!= 0x0A)
       {
         Arraydata[count]= Rx_data; 
         count++;
       }
       else
       {
        Arraydata[count]=0;
        if(flag);
        else
        count=0;
       }
       
       arrayptr=Arraydata;
       if(flag)
           data=Arraydata;
       if(strstr(arrayptr,ok))
       {
           RC_BIT_Flag=1;
       }
       else if(strstr(arrayptr,error))
       {
           RC_BIT_Flag=0;   
       
       }
       else if(strstr(arrayptr,newmsg))
       {
          msgflag=1;
       }
    }
  
}

please let me if any error..

I can read ok,error,and first message but if i am reading secound message i cannot.

once i read message i will delete the message
Code:
void MSG_READ()
{   
    flag=1;
    trans_string("AT+CMGR=1\r"); 
    delay(500);
    flag=0;
    trans_string("AT+CMGD=1\r");
    delay(100);
}

here i used flag. because after message i received "ok".
so im using flag to stop "count=0" in interrupt.

Thanks in advance..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top