From: Anthony Walter (sysrpl@hotmail.com) Subject: Re: Serial Port Baud Rate Newsgroups: borland.public.delphi.winapi Date: 1999/11/04 > I need to be able to set the baud rate of the serial port to a weird value > (~7680 baud) to interface with a piece of 'intelligent' equipment. > > With all of the standard software, I appear to be limited to the usual > values or get an error !! > > Any ideas . . . . . > It all depends on how you are accessing the COM port. If dealng with the API and not a wrapper you can get a handle to a COM port like so: PortHandle := CreateFile('COM1', GENERIC_READ or GENERIC_WRITE, 0, nil, OPEN_EXISTING, 0, 0); To fill out basic COM device infomation: GetCommProperties(PortHandle, ComProp); To display a COM config dialog: CommConfigDialog('COM1', SomeForm.Handle, ComConfig); In regards to you baud rate question, check out the VERY cool BuildCommDCB function. It takes and init string such as 'baud=7680 parity=N data=8 stop=1' and converts it into a BCD. You can then bind that data to the COM device using SetCommState(PortHandle, BCD). To re-initializes a communications resource use the SetupComm function. Of course all this stuff is SCREAMING for an object wrapper so I thought this might help get you started with a class interface declaration ... type TParity = (paEven, paMark, paNone, paOdd); TComPort = class private FDBC: TDBC; FHandle: THandle; FPort: Integer; function GetBaud: Integer; procedure SetBaud(const Value: Integer); procedure SetHandle(Value: THandle); function GetParity: TPariy; procedure SetParity(const Value: TPariy); procedure SetPort(Value: Integer); public constructor Create; destructor Destroy; override; procedure Open; procedure Close; function Init(const InitStr: string): Boolean; property Baud: Integer read GetBaud write SetBaud; property Handle: THandle read FHandle write SetHandle; property Parity: TPariy read GetParity write SetParity; property Port: Integer read FPort write SetPort; function Read(var Buffer; Count: Cardinal): Integer; function Write(var Buffer; Count: Cardinal): Integer; end; Anthony Walter sysrpl@hotmail.com