Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!cs.umn.edu!cybrspc!roy From: roy%cybrspc@cs.umn.edu (Roy M. Silvernail) Newsgroups: comp.os.msdos.programmer Subject: Serial Routine Kudos... and an addition. Message-ID: <8BZVy3w163w@cybrspc> Date: 16 Mar 91 05:20:06 GMT Organization: Villa CyberSpace, Minneapolis, MN Lines: 41 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}