Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send sms through AT Command acts weird

I am using ComPort component to send SMS messages via a modem the problem is that sometimes i get sms sometimes not sometimes i get the at commands in the body of the text message.

Here is my code:

procedure SendSmsCosmote(numar,text : string);
const
  buf : Byte = 26;
begin
  Form1.ComPort1.WriteStr('AT+CMGF=1'+#13#10);
  Form1.ComPort1.WriteStr('AT+CMGS="'+ numar + '"'+#13);
  Form1.ComPort1.WriteStr(text);
  Form1.ComPort1.Write(buf,1);
end;

What am I doing wrong? And why when I read from the modem I get what I sent on the tx line?

like image 703
opc0de Avatar asked May 22 '12 09:05

opc0de


People also ask

What is meant by AT commands?

AT commands are instructions used to control a modem. AT is the abbreviation of ATtention. Every command line starts with "AT" or "at". That's why modem commands are called AT commands.

What are AT commands in modem?

The AT commands are used to control the operation of your modem. They are called AT commands because the characters AT must precede each command to get the ATtention of the modem. AT commands can be issued only when the modem is in command mode or online command mode.

Which command instructions are used to control a GSM modem?

Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones.


1 Answers

Try adding slight delay between commands (or wait for modem reply, "OK" usually).

like image 88
Harriv Avatar answered Nov 15 '22 03:11

Harriv