[comp.sys.ibm.pc] Accessing the comm port with MS C

dg@lakart.UUCP (David Goodenough) (02/03/89)

I've just been landed with a project to write some software that communicates
with the modem and printer ports on a PC. I'm going to be using MS C V5.1,
but I have no real idea how to go about writing / reading / testing the
state of the ports. I need the following:

1. Check if the modem port has a character to read
2. Get that character
3. Write a character to the modem port
4. Write a character to the printer port

Also, if there is any code that needs to be executed to initiate the modem
port to run at 9600 (or possibly 19200) BPS, and 8N1, I'd want to know
about that too.

In addition I'd like to be able to "hook" into some form of system clock
tick, to execute a subroutine every 1/100th of a second or so. The exact
frequency is not important, but at least once every 1/10th of a second
would be desireable. I know the PC has a system clock, but I don't have
a clue how to get at it.

Please E-mail any answers, I don't usually get to read this group.

		Thanks in advance,
-- 
	dg@pallio.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!pallio!dg		+-+-+ |
AKA:	dg%pallio.uucp@cfisun.cfi.com		  	  +---+

izumi@violet.berkeley.edu (Izumi Ohzawa) (02/05/89)

In article <411@lakart.UUCP> dg@lakart.UUCP (David Goodenough) writes:
>I've just been landed with a project to write some software that communicates
>with the modem and printer ports on a PC. I'm going to be using MS C V5.1,
>but I have no real idea how to go about writing / reading / testing the
>state of the ports. I need the following:
>
>1. Check if the modem port has a character to read
>2. Get that character
>3. Write a character to the modem port
>4. Write a character to the printer port
>
>Also, if there is any code that needs to be executed to initiate the modem
>port to run at 9600 (or possibly 19200) BPS, and 8N1, I'd want to know
>about that too.
>

All of the above are supported by COMx port drivers which conform to
FOSSIL driver specification.
These drivers replace and extend BIOS INT14h.

You should be able to get a copy of the driver from most BBS systems
particularly those running OPUS BBS software.  These BBS software 
itself heavily depend on the driver.  And binaries are in public 
domain.

Also, I saw a FOSSIL driver in WSMR-SIMTEL20 archive.

Izumi Ohzawa
izumi@violet.berkeley.edu
...ucbvax!violet!izumi

jbayer@ispi.UUCP (Jonathan Bayer) (02/07/89)

In article <411@lakart.UUCP> dg@lakart.UUCP (David Goodenough) writes:
>I've just been landed with a project to write some software that communicates
>with the modem and printer ports on a PC. I'm going to be using MS C V5.1,
>but I have no real idea how to go about writing / reading / testing the
>state of the ports. I need the following:
>
>1. Check if the modem port has a character to read
>2. Get that character
>3. Write a character to the modem port
>4. Write a character to the printer port


Look into the book:

	C Programmer's Guide to Serial Communications

written by

		Joe Campbell

published by

			Howard Sams and Co.


JB

-- 
Jonathan Bayer			      Beware: The light at the end of the
Intelligent Software Products, Inc.	      tunnel may be an oncoming dragon
19 Virginia Ave.				...uunet!ispi!jbayer
Rockville Centre, NY 11570  (516) 766-2867    jbayer@ispi