HI
I am using AT89S52 to read a sms which attached to motorola C168. I need to transmit AT+CPMS="ME","ME","ME" to serial port as below, How can I do it?
Code:
void SMSString(char*text) ;
SMSString("AT\r"); // AT commands to initialize gsm modem
delay(50);
SMSString( "ATe0\r"); // turn off echo
delay(50);
SMSString( "AT+CPMS="ME","ME","ME"\r"); // select memory
delay(50);
SMSString( "AT&W\r"); // save settings
delay(50);
SMSString( "AT+CMGF=1\r"); // select text mode for sms
delay(50);
SMSString( "AT+CNMI=2,1,0,0,0\r"); // notification of new sms
When I am doing this in KEIL uVision3, there is an error called "error c141: syntax error near 'ME' ". How can I transmit to serial port without any trouble?
It is propably because you need to place a backslash (\) before a quotation mark (""). This is the way to keep your compiler happy about embodying quotation marks inside a declared string.
In real life you would say AT+CPMS="ME","ME","ME", but in C it must be like:
Hi,
Thanks for your help. I works now. I have another problem, that is when I am sending a SMS using AT command (AT+CMGS="tel no" message and ctrl+z) it will successfully send. but I cant read the received sms. It will show as <unreadable format>. What is wrong with my AT commands?
OK, now it makes sence. This means that you are not sending ASCII characters from the GSM or there is some violation of the send sms command. Double check the code that sends the sms payload from your MCU to the GSM.
If you can debug the code, it would be really usefull to stop before you send the sms and check the contents of the serial output buffer.
How can I check whether I an sending ASCII characters or not? How can I set up the basic configurations to send ASCII characters from my GSM module (Motorola C168).