Article View: comp.os.msdos.programmer
Article #815Re: Serial and Parallel Ports
From: jdishaw
Date: Fri, 17 Apr 1992 05:11
Date: Fri, 17 Apr 1992 05:11
31 lines
2152 bytes
2152 bytes
In article <johnr.703398126@wambenger>, johnr@cs.uwa.oz.au (John Redman) writes: > This is probably a very basic kind of thing to > ask, but -- > > How do I go about reading and sending > information from/to serial and parallel > ports? Actually it is not a very basic kind of thing, but rather a very good question. Working with either port is rather tricky. Lets consider the parallel port first. The parallel port, as setup up by default on the PC, has 12 output pins and 5 input pins (if I remember correctly). Depending on the chip used in your PC and how it is setup, you might be able to redefine which pins are input and which are output. The serial port has essential a transmit pin, a receive, and a couple signal pins. The tricky part now is recovering the information from the ports. The easiest method is to constantly poll the port and see if a new byte has arrived. This unfortunately sucks up some CPU time and also precludes high speed data transfer. The preferred method to use is to set-up an interrupt service that gets called whenever a incoming byte is recevied. Transmitting is usually pretty easy. You stick the byte to be transmitted and that is it. If you want high speed communication (especially on a serial port), you might have to setup an interrupt service that feeds the port whenever a byte has been transmitted. Thus the ideal setup is to double buffer the port you want to use. If you want information on the parallel port, a good person to talk to is fdeck@grumpy.helios.nd.edu. I've done some work, but I haven't gotten my double buffering code to work yet so I wouldn't be the best person to talk to. -james dishaw JDISHAW@POMONA.CLAREMONT.EDU
Technical Details
Message-ID:
<1992Apr16.221133.1@acme.claremont.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!elroy.jpl.nasa.gov!news.claremont.edu!acme.claremont.edu!jdishawReferences:
<johnr.703398126@wambenger>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!usc!elroy.jpl.nasa.gov!news.claremont.edu!acme.claremont.edu!jdishaw From: jdishaw@acme.claremont.edu Subject: Re: Serial and Parallel Ports Message-ID: <1992Apr16.221133.1@acme.claremont.edu> Lines: 31 Sender: news@muddcs.claremont.edu (The News System) Organization: Pomona College References: <johnr.703398126@wambenger> Date: 16 Apr 92 22:11:33 PDT