delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/18/06:27:58

Date: Thu, 18 May 2000 11:24:43 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Florent <florent AT oih DOT rwth-aachen DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: com1 programming .... a lot of question
In-Reply-To: <8fudhg$jnb$1@nets3.rz.RWTH-Aachen.DE>
Message-ID: <Pine.SUN.3.91.1000518112402.12245B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 17 May 2000, Florent wrote:

> then I want to test byte with all the values in order to get the settings of
> the COM1, I do :
>
> if ((byte&_COM_9600)==_COM_9600) printf ("9600 bauds);

No, you cannot do that.  There is no way to read back the baudrate,
stop bits, parity, and other settings using _bios_serialcom.  You
simply need to trust _bios_serialcom to do its job.

The value _bios_serialcom returns does not specify any of the _COM_*
settings.  For the full description of the values returned by
_bios_serialcom, please refer to its docs in libc.info; reading the
docs of its sibling function bioscom might also help.

Do you have any reason to believe that _bios_serialcom doesn't work?
Perhaps your program simply works...  If it doesn't work, please
describe what fails.

> state=_bios_serialcom(_COM_INIT,0,_COM_9600 | _COM_CHR8 | _COM_STOP1 |
> _COM_NOPARITY);
> 
> There is something strange also, I test the constante _COM_STOP1, _COM_STOP2
> and _COM_EVENPARITY and there are egal to 0 !!!! Hwo can I know if my
> settings is one stop bit or 2 if both constante egal to 0 !!

To test what is the setting of stop bit, compare (state & 4) with
_COM_STOP1 and _COM_STOP2.  To test the parity, compare (state & 24)
with _COM_EVENPARITY, _COM_NOPARITY, and _COM_ODDPARITY.  To test the
baudrate, compare (state & 0xe0) with _COM_9600 and similar constants.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019