[fpc-pascal] Serial Unit for Windows

Zaher Dirkey parmaja at gmail.com
Sat Jul 19 16:18:27 CEST 2008


>>    bm_DCB_fRtsControl = $3000. It should be $2000.
>>    bm_DCB_fDtrControl = $30. It should be $20.

DtrControl and RtsControl have double bits so it should be as mask

in same struct.inc you can see

  function fDtrControl(var a : DCB) : DWORD;
    begin
       fDtrControl:=(a.flags and bm_DCB_fDtrControl) shr bp_DCB_fDtrControl;
    end;

here fDtrControl return a number 0..3 as DWORD not boolean.

for your code is wrong becuase dtrcontrol/rtscontrol have 4 state not
one as you use it

  if DtrDsrFlowControl in Flags then
    DCB.Flags := DCB.Flags or bm_DCB_fOutxDsrFlow or (bm_DCB_fDtrControl -$10);


You can use new constants like as synaser http://synapse.ararat.cz/doku.php

  dcb_DtrControlMask = $00000030;
  dcb_DtrControlDisable = $00000000;
  dcb_DtrControlEnable = $00000010;
  dcb_DtrControlHandshake = $00000020;

  dcb_RtsControlMask = $00003000;
  dcb_RtsControlDisable = $00000000;
  dcb_RtsControlEnable = $00001000;
  dcb_RtsControlHandshake = $00002000;
  dcb_RtsControlToggle = $00003000;



More information about the fpc-pascal mailing list