www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/02/16:20:57

From: wsimpson AT my-deja DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: _bios_serialcom() in djgpp
Date: Thu, 02 Mar 2000 16:00:09 GMT
Organization: Deja.com - Before you buy.
Lines: 40
Message-ID: <89m367$mjn$1@nnrp1.deja.com>
NNTP-Posting-Host: 193.62.250.209
X-Article-Creation-Date: Thu Mar 02 16:00:09 2000 GMT
X-Http-User-Agent: Mozilla/4.7 [en] (X11; U; Linux 2.2.12-20 i686; Nav)
X-Http-Proxy: 1.0 x24.deja.com:80 (Squid/1.1.22) for client 193.62.250.209
X-MyDeja-Info: XMYDJUIDwsimpson
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I have a Turbo C (+ litecomm library) program that reads com1
successfully. I am trying to port it to djgpp.

I am using the _bios_serialcom() function. I am not expert in using the
serial port, so I find the info files quite hard to understand. When I
do
_bios_serialcomm(_COM_INIT,...)
how can I tell if the initialization was successful? Please give me a
djgpp code fragment. The info page says something about the low-order
bits, but I don't know how to check bits in C. I also don't understand
the table in the info page

Similarly, when I do
_bios_serialcomm(_COM_RECEIVE,...)
how can I tell if I received the data OK?  From the info page it sounds
like if I do

char data;
...
data=_bios_serialcomm(_COM_INIT,0,0); /*read from com1*/
then data will contain the word (8 bits) I read from com1. If
unsuccessful, bit 9, 10, 11, or 15 is set. I don't know how to check
this. Please show me how (code fragment).

My current problem is that when I try to read the device hooked up to
com1, I get nothing really. If I print it as
%d the value is 32768
%c prints a vertical space
%s garbage
I think it is because the initialization of the port failed, or because
the reading of the data from the port failed, or both. Hence my
questions.

Thanks very much for any help!

Bill


Sent via Deja.com http://www.deja.com/
Before you buy.

- Raw text -


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