[net.micro.pc] Pascal and C access to com ports

ugthomas@sunybcs.UUCP ( Timothy Thomas) (03/23/85)

After using several different communication packages on the market; I have
decided to write my own because not all of them do what I want.

I have decided to write it in either Turbo Pascal, or Lattice C.  My main
problem right now is sending and receiving data from the com1: port.  I 
have only played around with it in Turbo Pascal, and can send data ok (I
think) to the port, but how can I tell if there is data 'waiting' in the
port to print?
I cant do a read from the port to check; otherwise it will just sit there
and wait for data to come in.  What I would like to know is how to do
some sort of a status on the port.  Can anyone help me?

Please send responses via mail.

Thanks in advance,

-- 
...Tim Thomas

...{burdvax, rocksvax, bbncca, decvax, dual, rocksanne, watmath}!sunybcs!ugthomas


Remember......
	Only you can prevent software piracy.

geller@rlgvax.UUCP (David Geller) (03/25/85)

> I have decided to write it in either Turbo Pascal, or Lattice C.  My main
> problem right now is sending and receiving data from the com1: port.  I 
> have only played around with it in Turbo Pascal, and can send data ok (I
> think) to the port, but how can I tell if there is data 'waiting' in the
> port to print?
> I cant do a read from the port to check; otherwise it will just sit there
> and wait for data to come in.  What I would like to know is how to do
> some sort of a status on the port.  Can anyone help me?

You should refer to the IBM PC Technical reference manual.  It will
describe the status ports for the asychronous communications adaptor.  By
"polling" the status port you can tell if there is something available
in the single-character input buffer.  If you would like to avoid a great
deal of work you might consider using The GreenLeaf Comm Library (see
current magazine for more complete description).  This library provide
the C program with all of the necessary hooks and functions for both
"polled" and interupt driven serial I/O. Do check the Tech Ref however.

						David Geller
						rlgvax!geller

"If I mentioned a company or product name I did so without any intention
of implying I was connected to or affiliated with the said company or
product"