var fHandle:Integer;
prnstr:string;//发向串口的命令
dcb:TDCB;
try
fHandle := fileopen('COM1', fmOpenWrite);
if fHandle > 0 then
begin
SetupComm(fHandle,1024,1024);
GetCommState(fHandle,dcb) ;
dcb.BaudRate :=baud;
dcb.ByteSize :=8;
dcb.Parity :=NOPARITY;
dcb.StopBits :=ONESTOPBIT;
filewrite(fHandle, prnstr[1], length(prnstr)) ;
end
finally
fileclose(fHandle);
end;
//GetCommPropertie试试