[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

AT Commands

Hi Experts
How can I connect to my modem and send AT commands.
I'd also like to read the text that the modem send back as answer.
Andrea.
0
borgo
Asked:
borgo
  • 3
  • 2
1 Solution
 
intheCommented:
use any of the comport components from here:
http://www.torry.ru/comms.htm
most of them have examples that show what you are trying to do especially async32.zip and cdd4.zip.
Regards Barry
0
 
intheCommented:
you can type atdt 555-555-555 etc ..your modem manual should have a list of the commands or i can give you some links to command sets if you need them.
0
 
borgoAuthor Commented:
Thank you very much Inthe

Have a nice day and happy Christmas if I won't see you again before the 25th.

0
 
intheCommented:
hi borgo,
cheers you also have a good christmas :-))

btw if you diont wanna component maybe this is alsio of help:


procedure InitModem;
Var CommPortTimeOuts: TCommTimeouts;
    DCB: TDCB;
    hCommFile : THandle;
  ReadBuffer: array[0..100] of char;
  NumberRead: DWord;
begin
 
    { Open the comm port. }
    hCommFile := CreateFile(PChar('COM1'),GENERIC_READ +
GENERIC_WRITE,0,nil,OPEN_EXISTING,FILE_FLAG_WRITE_THROUGH,0);
    if hCommFile = INVALID_HANDLE_VALUE then
    begin
          ShowMessage('Unable to open COM1!');
          exit;
    end;
 
    { Set Timeout values for the comm port. }
    CommPortTimeOuts.ReadIntervalTimeout        := 100;
    CommPortTimeOuts.ReadTotalTimeoutMultiplier  := 100;
    CommPortTimeOuts.ReadTotalTimeoutConstant    := 0;
    CommPortTimeOuts.WriteTotalTimeoutMultiplier := 0;
    CommPortTimeOuts.WriteTotalTimeoutConstant  := 0;
    SetCommTimeOuts(hCommFile,CommPortTimeOuts);
 
    { Set the comm port parameters. }
    GetCommState(hCommFile,DCB);
    DCB.BaudRate := 1200;
    DCB.ByteSize := 7;
    DCB.StopBits := ONESTOPBIT;
    DCB.Parity  := EVENPARITY;
    SetCommState(hCommFile,DCB);
 
    { Send initialization string to the port. }
    ReadBuffer := '';
    StrPCopy(ReadBuffer,'ATZ' + #13 + #10);
 
WriteFile(hCommFile,ReadBuffer,Length(ReadBuffer),NumberRead,NIL);
 
    { Get a response from the port. }
    ReadBuffer := '';
    ReadFile(hCommFile,ReadBuffer,100,NumberRead,NIL);
 
    { Close the port. }
    CloseHandle(hCommFile);
end;


Regards Barry (and happy new year :-)
0
 
borgoAuthor Commented:
Thank you

A nice day to you Barry

Andrea

0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now