Přístum k portu (delphi program):
Kód: Vybrat vše
function TForm1.OpenCOM(DeviceName: string): integer;
var DCB: TDCB;
begin
if PortHandle > 0 then CloseHandle(PortHandle);
PortHandle:=CreateFile(PChar(DeviceName),GENERIC_READ or GENERIC_WRITE,0,NIL,OPEN_EXISTING,0,0);
GetCommState(PortHandle,DCB) ;
DCB.BaudRate:=256000;
SetCommState(PortHandle,DC B) ;
result := PortHandle;
end;
procedure TForm1.SetT XD State(State: Boolean);
begin
if not State then
ClearCommBreak(PortHandle)
else
SetCommBreak(PortHandle);
end;