🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1842

Re: Microsoft C & serial comms

#1842
From: Mark A. Feit
Date: Fri, 10 Aug 1990 17:42
56 lines
3151 bytes
In article <990@dcl-vitus.comp.lancs.ac.uk> se@comp.lancs.ac.uk (Steve Elliott) writes:

   I'd like some advice/help on the above topic.
   Specifically, I'm trying to program a card reader through
   COM1 with a Microsoft C (v5.1) program.
   To initialise the lock, the docs state that "break level must be
   off more than 2 seconds".

   That's got me stumped.

Don't sweat it.  Serial communications is a real jungle.

   What is break level?

The "break condition" means the UART must set the TXD line to its
"space" condition and hold it there for longer than one SDU (serial
data unit, the length of time it takes to transmit start, data,
parity, and stop bits for one character).  In your case, you must have
the UART hold the TXD line in its space condition for at least two
seconds.

   Can I program it from C?

Yes and no.  Your best bet is to write a short assembly-language
driver which will alter the UART's line control register (LCR), wait
for two seconds, and reset it to its normal state.

A little advice if I may: Head for your local bookstore and pick up a
copy of "C Programmer's Guide to Serial Communications" by Joe
Campbell.  It's published by Howard W. Sams and Company, lists for
$22.95, and contains two disks with source code of all examples in the
book.  It's a worthwhile investment if you're going to be doing any
communications work on PCs.  (It also includes an XMODEM driver
written in C, which I found really handy on my current project.)


						- Mark

................................... ................................... 
: Mark A. Feit                     : feit@cs.odu.edu                  :
: Old Dominion University CS Dept. : ...!xanth!feit                   :
: Norfolk, Virginia, U.S.A., Earth : "Where are my socks, anyway?"    :
................................... ................................... 
"Programming is 10% science, 25% ingenuity, and 65% the art of getting
the ingenuity to work with the science."
--

						- Mark

................................... ................................... 
: Mark A. Feit                     : feit@cs.odu.edu                  :
: Old Dominion University CS Dept. : ...!xanth!feit                   :
: Norfolk, Virginia, U.S.A., Earth : "Where are my socks, anyway?"    :
................................... ................................... 
"Programming is 10% science, 25% ingenuity, and 65% the art of getting
the ingenuity to work with the science."
Technical Details
Message-ID: <FEIT.90Aug10134238@offa.cs.odu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!abcfd20.larc.nasa.gov!xanth!xanth.cs.odu.edu!feit
References: <990@dcl-vitus.comp.lancs.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!abcfd20.larc.nasa.gov!xanth!xanth.cs.odu.edu!feit
From: feit@cs.odu.edu (Mark A. Feit)
Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer
Subject: Re: Microsoft C & serial comms
Message-ID: <FEIT.90Aug10134238@offa.cs.odu.edu>
Date: 10 Aug 90 17:42:38 GMT
References: <990@dcl-vitus.comp.lancs.ac.uk>
Sender: news@cs.odu.edu
Followup-To: comp.os.msdos.programmer
Organization: The Von Neumann Hospital for Unix Burnouts
Lines: 56
In-reply-to: se@comp.lancs.ac.uk's message of 8 Aug 90 13:04:22 GMT