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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
ASKER
Thank you very much Inthe
Have a nice day and happy Christmas if I won't see you again before the 25th.
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'),G ENERIC_REA D +
GENERIC_WRITE,0,nil,OPEN_E XISTING,FI LE_FLAG_WR ITE_THROUG H,0);
if hCommFile = INVALID_HANDLE_VALUE then
begin
ShowMessage('Unable to open COM1!');
exit;
end;
{ Set Timeout values for the comm port. }
CommPortTimeOuts.ReadInter valTimeout := 100;
CommPortTimeOuts.ReadTotal TimeoutMul tiplier := 100;
CommPortTimeOuts.ReadTotal TimeoutCon stant := 0;
CommPortTimeOuts.WriteTota lTimeoutMu ltiplier := 0;
CommPortTimeOuts.WriteTota lTimeoutCo nstant := 0;
SetCommTimeOuts(hCommFile, CommPortTi meOuts);
{ 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,ReadBu ffer,Lengt h(ReadBuff er),Number Read,NIL);
{ Get a response from the port. }
ReadBuffer := '';
ReadFile(hCommFile,ReadBuf fer,100,Nu mberRead,N IL);
{ Close the port. }
CloseHandle(hCommFile);
end;
Regards Barry (and happy new year :-)
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'),G
GENERIC_WRITE,0,nil,OPEN_E
if hCommFile = INVALID_HANDLE_VALUE then
begin
ShowMessage('Unable to open COM1!');
exit;
end;
{ Set Timeout values for the comm port. }
CommPortTimeOuts.ReadInter
CommPortTimeOuts.ReadTotal
CommPortTimeOuts.ReadTotal
CommPortTimeOuts.WriteTota
CommPortTimeOuts.WriteTota
SetCommTimeOuts(hCommFile,
{ 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,ReadBu
{ Get a response from the port. }
ReadBuffer := '';
ReadFile(hCommFile,ReadBuf
{ Close the port. }
CloseHandle(hCommFile);
end;
Regards Barry (and happy new year :-)
ASKER
Thank you
A nice day to you Barry
Andrea
A nice day to you Barry
Andrea