Lo único que se me ocurre es que también tenga que estar activada la linea DTR además de RTS. Vamos a cambiar los Flags de tal modo que estas se activen al abrir el puerto y permanezcan activas. Echo este cambio no abría ninguna diferencia entre lo que estamos haciendo nosotros y lo que hace el hyperterminal.
Código Delphi
[-]
function Peso(Puerto: String): String;
var
hPort: THandle;
DCB: TDCB;
Leidos: Cardinal;
C: char;
begin
Result:= '';
Puerto:= Uppercase(Puerto);
if (Puerto<>'COM1') and (Puerto<>'COM2') then
exit;
hPort:= CreateFile(PChar('\\.\'+Puerto), GENERIC_READ or GENERIC_WRITE,0, nil,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if hPort<>INVALID_HANDLE_VALUE then
begin
DCB.DCBlength:= sizeof(DCB);
if GetCommState(hPort,DCB) then
begin
with DCB do
begin
BaudRate := CBR_9600;
ByteSize := 7;
Parity := ODDPARITY;
StopBits := TWOSTOPBITS;
Flags := $1013;
end;
if SetCommState(hPort, DCB) then
begin
PurgeComm(hPort, PURGE_TXABORT or PURGE_RXABORT or PURGE_TXCLEAR or
PURGE_RXCLEAR);
C:= #0;
repeat
ReadFile(hPort,C,1,Leidos,nil);
until C = #02;
repeat
ReadFile(hPort,C,1,Leidos,nil);
if C <> #13 then
Result:= Result + C;
until C = #13;
end;
end;
CloseHandle(hPort);
end;
end;
Esperemos que haya suerte de esta vez, ya me quede sin ideas