🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1073

Re: Setting up serial ports

#1073
From: Roy M. Silvernail
Date: Tue, 05 Jan 1993 00:36
40 lines
2484 bytes
jenk@microsoft.com (Jen Kilmer) writes:

> In article <1992Dec30.200952.5153@panther.mot.com> ronf@panther3.panther.mot.
> >Being my first post, I hope this is the appropriate newgroup.
> >
> >I am a Unix/C/Assembler type that finds himself in the position of having to
> >write/port an app. on an IBM PC.  One of the functions needed is to establis
> >carrier on a modem.  My problem?  How do I setup the com?: port using 'C'.
> >Asking the user to use the DOS mode command would be sort of kludgy.
> 
> Well, if you wanted to do what the ms-dos mode command does, it
> does an int 21 to set up the serial port. The int 21 is implemented
> throught the serial port device driver [also a part of msdos unless 
> you've installed a replacement for the default one in io.sys] which
> eventually does a BIOS call. The BIOS then talks to the UART directly.

Jen, I really like the delicacy with which you've phrased this.  :-)

The best way I have found to handle the com port from C is to use an
interrupt-driven library.  I never, ever use bioscom().

> You can of course talk to the UART or the BIOS yourself, and skip msdos
> - particularily if you want to program the chip in a method not provided
> by msdos/BIOS.

Or if you want to handle data rates in excess of 1200 baud successfully.
The BIOS routines aren't interrupt-driven, and polling a port is most
difficult when you are capturing and processing high-speed data.  Your
mileage may vary, of course, but it makes sense to me to be prepared for
the worst from the start.  A good library will support you up to 57,600
bps (and perhaps beyond).

Granted, this application may need only a few bytes and an asserted DCD
line... but the next one might need to handle a 19,200 modem.  If you
start with a library now, you'll be up to speed with it when the time
comes to increase capability.
--
Roy M. Silvernail --    [my opinions] "You can't be serious!"
roy%cybrspc@cs.umn.edu  [get 'em now]   "Sure, I _can_..."
cybrspc!roy@cs.umn.edu  [send $19.93]        -- me
Technical Details
Message-ID: <FVoVwB5w165w@cybrspc.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!umn.edu!cybrspc!roy
References: <1993Jan04.043635.5841@microsoft.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!umn.edu!cybrspc!roy
From: roy%cybrspc@cs.umn.edu (Roy M. Silvernail)
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.la
Subject: Re: Setting up serial ports
Message-ID: <FVoVwB5w165w@cybrspc.UUCP>
Date: Mon, 04 Jan 93 18:36:26 CST
References: <1993Jan04.043635.5841@microsoft.com>
Organization: Villa CyberSpace, Minneapolis, MN
Lines: 40