I’ve succeeded in switching into command mode. I needed to read the SMS and switch back into data mode again. But when I enter “ATO0” command, It replies “OK”. But not connecting into data mode. Instead it resets the modem. I need to switch back into data mode without stopping the service and resetting the modem.
void ReadSMS(void)
{
unsigned char MSGBuffer[40];const char limit[2]=",";char *to = (char*) malloc(6);
Modem_Send("+++",3);// Enable Command Mode for HL6528
delay_1Sec(1);
ModemWaitForAtResponse(NULL,80,10);
GPRS_Data_Mode=0;
Modem_Send("AT+CMGF=1\r\n",12);
ModemWaitForAtResponse(NULL,80,10);
Modem_Send("AT+CMGR=1\r\n",12);
//ModemWaitForAtResponse(NULL,80,30);
ModemWaitForAtResponse((char *)MSGBuffer,80,40);
printf("*****************\r\n");
printf("%s\r\n",MSGBuffer);
Modem_Send("ATO0\r\n",6);
ModemWaitForAtResponse(NULL,80,60);
delay_1Sec(1);
}