🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1695

Re: Windows' Serial Port

#1695
From: Chris Marriott
Date: Sat, 12 Dec 1992 18:22
49 lines
2654 bytes
In article <57000004@hplvec.LVLD.HP.COM> rozum@hplvec.LVLD.HP.COM writes:

>I have just resently started programing in the Windows 3.1 environment.
>
>I have been trying to figure out the serial capability using windows.
>
>My questions are as follows:
>
>1) How do I read and write to a serial port?
>

It's pretty easy.  Just use the OpenComm, ReadComm, WriteComm, CloseComm
functions for the actual reading and writing, and "BuildCommDCB" and
"SetCommState" if you want to set the port characteristics.

If you're using Windows 3.0, you'll need to keep polling the comms port to
see if data has arrived.  In 3.1 it's a lot easier.  Call
"EnableCommNotification" and you'll the be send "WM_COMMNOTIFY" messages
when data arrives, or when a transmission finishes.

>2) How fast can Windows received data without data being over-
>   written in the serial's data register?  In other words,
>   does Windows have a serial buffer, if so how fast can the serial
>   data be retrieved?
>

With a "standard" serial port card, the practical limit is probably 9600 bps.
With a 16550-based card you can go to 38400 without too many problems.
If you're using Windows-based comms, it's probably sensible to tell the user
(or,better, get your installation program) to set the "COMxBUFFER" parameter
in the WIN.INI file.  Default value is (I think) 128 bytes.  2k or so is a
more sensible value to use.

>3) When working with the serial port is there any special
>   consideration that needs to be taken into account?
>

I can't think of any.  Obviously, writing comms software is never exactly
easy, but I've found it easier to do in Windows than DOS.

Hope this information helps.

--------------------------------------------------------------------------
| Chris Marriott                   | chris@chrism.demon.co.uk            |
|                                  | BIX: cmarriott                      |
| (Still awaiting inspiration      | CIX: cmarriott                      |
|  for a witty .sig .... )         | Compuserve: 100113,1140             |
--------------------------------------------------------------------------
 
Technical Details
Message-ID: <724184577snz@chrism.demon.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
References: <57000004@hplvec.LVLD.HP.COM>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
From: chris@chrism.demon.co.uk (Chris Marriott)
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
Subject: Re: Windows' Serial Port 
Distribution: world
References: <57000004@hplvec.LVLD.HP.COM>
Organization: None
Reply-To: chris@chrism.demon.co.uk
X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
Lines: 49
Date: Sat, 12 Dec 1992 18:22:57 +0000
Message-ID: <724184577snz@chrism.demon.co.uk>
Sender: usenet@demon.co.uk