michaelh@neon.Stanford.EDU (Mike Hennahane) (03/08/91)
Help!!!!
The Problem: I'm trying to send an ASCII string to the modem port and
read the response. simple, huh? I thought that it would be. I'm using
THINK pascal, and my code follows.
What happens: nothing. I open the serial port, configure the input and
output devices, send my command, and read the response. None of my
calls returns an error. The return buffer is usually empty, but
sometimes echoes back the command that I sent it. In the code here,
I'm just sending a simple modem reset, and don't get an 'OK' back.
Please respond via email. My address is michaelh@neon.stanford.edu.
I'm pretty frustrated; it's always seems to be something simple that I
just don't know about...
thanks,
--mike
program serial;
uses
serial;
var
result: OSErr;
AoutRefNumber, AinRefNumber: integer;
command: str255;
return: string[64];
count: longint;
serStatIn, serStatOut: SerStaRec;
begin
result := OpenDriver('.AOut', AoutRefNumber);
result := serReset(AoutRefNumber, baud9600 + stop10 + noParity + data8);
result := OpenDriver('.AIn', AinRefNumber);
result := serReset(AinRefNumber, baud9600 + stop10 + noParity + data8);
result := SerStatus(AoutRefNumber, serStatOut);(* just to check for errs in debugger *)
result := SerStatus(AinRefNumber, serStatIn);
command := concat('ATZ', chr(13));
count := length(command);
result := FSWrite(AoutRefNumber, count, @command);
result := SerGetBuf(AinRefNumber, count);
result := FSRead(AinRefNumber, count, @return);
writeln('result: ', return);
result := CloseDriver(AoutRefNumber);
result := CloseDriver(AinRefNumber);
end.