[comp.os.msdos.programmer] Serial Routine Kudos... and an addition.

roy%cybrspc@cs.umn.edu (Roy M. Silvernail) (03/16/91)

Kudos upon David Kessner for posting his serial interfacing routines
last month.  I've had occasion to directly compare them with the library
I had been using (IBMCOM.C, from SIMTEL) and David's come in about twice
as fast in character retrieval. The interface is similar enough to
IBMCOM that replacing the library was an easy task.

A couple of points, though, that didn't come through clearly in the
documentation...

The AsyncHand routine wants the whole set of flags upon invocation. At
first, I had tried AsyncHand(~DTR) to drop DTR, but soon found it didn't
work. With the 2 main control bits being DTR and RTS, AsyncHand(RTS)
drops DTR just fine, and (of course) AsyncHand(DTR | RTS) raises it once
again.

AsyncSet wants a speed and another number that represents parity, length
and stop bits. The example given is 3 for 8N1, but I had need of 7E1 and
7O1, as well. After spelunking a couple of references, I came up with
the following defines, now included in async.h:

/* Defines for Com Port Paramaters */
#define BITS_8          0x03
#define BITS_7          0x02
#define STOP_1          0x00
#define STOP_2          0x04
#define EVEN_PARITY     0x18
#define ODD_PARITY      0x08
#define NO_PARITY       0x00

This makes it simple to set up your port...

AsyncSet(2400, BITS_8 | NO_PARITY | STOP_1);

(yes, 8_BITS is more intuitive, but Turbo C chokes on it and wants an
alpha for the first character of a #define)

Again, public thanks to David! A fine piece of work he posted.
--
Roy M. Silvernail --  roy%cybrspc@cs.umn.edu - OR-  cybrspc!roy@cs.umn.edu
  perl -e '$x = 1/20; print "Just my \$$x! (adjusted for inflation)\n"'
        [space reserved for clever quote]{mail your submissions}

david@kessner.denver.co.us (David Kessner) (03/16/91)

In article <8BZVy3w163w@cybrspc> roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes:
>Kudos upon David Kessner for posting his serial interfacing routines
>last month.

Thanks for putting them into good use!  I wrote them about a year ago for
an Inter-Library Loan Network program-- as my first attempt at assembly 
on a PC!  I'm more than happy to share any program that I write...

>I've had occasion to directly compare them with the library
>I had been using (IBMCOM.C, from SIMTEL) and David's come in about twice
>as fast in character retrieval. The interface is similar enough to
>IBMCOM that replacing the library was an easy task.

Hmmm.  That's interesting.  I have used these routines at 9600 baud without
any problems, but have never tested them at high speeds.  I guess that I will
soon as I am not satisfied with any VT100/220/etc emulator on the PD market--
and need speeds as high as 38400 baud...  

BTW.  Is there anywhere that I can get the official specs for VT100/220/etc
terminals?  I'll be sure to tell you all when the term emulator is done...

>A couple of points, though, that didn't come through clearly in the
>documentation...
[ ... additions to the documentation/header files deleted ... ]

Ok...  Geez, does it show that the routines and documentation was a little
hastily put together?  Thanks.  I'll place your additions in what I have
here-- for consistancy sake...

>Again, public thanks to David! A fine piece of work he posted.

Your welcome.  I'm glad they are being put to use (with someone other than
librarians running on Apple II's at 1200 baud).

>Roy M. Silvernail --  roy%cybrspc@cs.umn.edu - OR-  cybrspc!roy@cs.umn.edu

				- David K
-- 
David Kessner - david@kessner.denver.co.us            | do {
1135 Fairfax, Denver CO  80220  (303) 377-1801 (p.m.) |    . . .
If you cant flame MS-DOS, who can you flame?          |    } while( jones);