Link to home
Start Free TrialLog in
Avatar of borgo
borgo

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of inthe
inthe

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.
Avatar of borgo

ASKER

Thank you very much Inthe

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

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 :-)
Avatar of borgo

ASKER

Thank you

A nice day to you Barry

Andrea