Mail Archives: djgpp/2000/05/18/06:27:58
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 -