🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.4dos
Article #19

Re: parallel-port pin layout

#19
From: David Kirschbaum
Date: Tue, 07 Jul 1998 00:00
860 lines
30913 bytes
This is a multi-part message in MIME format.

--------------44815FF259F8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

claudio minutella wrote:
> 
> hi,
> 
> i'd like to enable some databits on the parallelport
> by a small basic programm, but i need to know the
> pin-layout of the parallelport. any map out there ?
> 
> any help would be very apreciated ... claudio :)
> --
> 
> ------
> claudio minutella               mail : minutella@tic.ch
> tic the internet company ag     www  : http://www.tic.ch
> nidfeldstrasse 5                tel  : +41 41 318 36 81
> CH - 6010 kriens                fax  : +41 41 318 36 86
> ................. why use WINDOWS, when there is a door ?

Two attached text files, a collection of various parallel port stuff I
had tucked away.  It's old but should still be useful.

Regards,
David
-- 
Visit Toad's web page at http://www2.carolina.net/NOkirschdSPAM

Remove the "NOSPAM" from my address to respond or visit.

--------------44815FF259F8
Content-Type: text/plain; charset=iso-8859-1; name="Par_port.msg"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="Par_port.msg"

Area:    Technical		Date:	18 Dec 95
From:    Frank Cox		To:	DWIGHT FRANCIS
Subject: 2-WAY LPT TRANSFERS

 > Can anyone tell me how to receive data on a parallel port? 
 > Code snippets are welcome in any (Pascal, C , Assembly, or 
 > Basic) language.

Here is an old text file that I have laying around here:

07/26/87

This document  details the parallel printer ports of the IBM-PC
Each of the printer ports conforms to a modified Centronics Parallel
Interface. The connection to the PC is through a DB25 25 pin connector.
The IBM-PC will support up to three parallel ports. Each port provides
12 TTL outputs and 5 TTL inputs.  This document contains the following
data:
      a. DB25 PINOUT, and signal names where known.
      b. PORT addresses of each parallel port.
      c. DATA, CONTROL, and INPUT PORTS pinouts w/bit positions
         within each byte.
      d. Example programs written in C highlighting input and
         output to the ports.
      e. Clock display circuit diagram w/parts list.
      f. Closing comment.

                           DB25 PINOUT

                        ��������������ͻ
           -STROBE ---> �  1           �
                        �         14   � <------  -AUTO FEED
            D0 -------> �  2           �
                        �         15   � ------> ?
            D1 -------> �  3           �
                        �         16   � <------ INITIAL
            D2 -------> �  4           �
                        �         17   � <------  -?
            D3 -------> �  5           �
                        �         18   � <------+
            D4 -------> �  6           �        |
                        �         19   �    G   |
            D5 -------> �  7           �        |
                        �         20   �    R   |                      ��ͻ
            D6 -------> �  8           �        |  Output Signal ----> �  �
                        �         21   �    O   |  (From Computer)     ��ͼ
            D7 -------> �  9           �        |
                        �         22   �    U   |
            ACK <------ �  10          �        |
                        �         23   �    N   |
           -BUSY <----- �  11          �        |                      ��ͻ
                        �         24   �    D   |   Input Signal <---- �  �
            PE <------- �  12          �        |   (To Computer)      ��ͼ
                        �         25   � <------+
            SEL <------ �  13          �
                        ��������������ͼ


           Pins 1, 11, 14, 17 are negative TTL, meaning

                       0 is ON & 1 is OFF



         PARALLEL Port Addresses    DATA PORT (Output from computer)


         LPT1: 956     3BC Hex
         LPT2: 888     378 Hex
         LPT3: 632     278 Hex


         �������������������������������������������������������ͻ
         �      �      �      �      �      �      �      �      �
         �      �      �      �      �      �      �      �      �
         �  D7  �  D6  �  D5  �  D4  �  D3  �  D2  �  D1  �  D0  �
         �      �      �      �      �      �      �      �      �
         �      �      �      �      �      �      �      �      �
         �������������������������������������������������������ͼ


PIN  #      9       8      7      6      5       4      3       2
BIT  #      7       6      5      4      3       2      1       0
VALUE     128      64     32     16      8       4      2       1



         PARALLEL Port Addresses    CONTROL PORT (Output from computer)


         LPT1: 958     3BE Hex
         LPT2: 890     37A Hex
         LPT3: 634     27A Hex



         �������������������������������������������������������ͻ
         �      �      �      �      �      �      �      �      �
         �      �      �      �      �      �      �      �      �
         �  NA  �  NA  �  NA  �  NA  �  -?  � INIT �  -AF � -ST  �
         �      �      �      �      �      �      �      �      �
         �      �      �      �      �      �      �      �      �
         �������������������������������������������������������ͼ


PIN  #      -       -      -      -     17      16     14       1
BIT  #      -       -      -      -      3       2      1       0
VALUE       -       -      -      -      8       4      2       1


         Notes:

              1. -? denotes negative TTL signal, name unknown.
              2. INIT is INITIAL.
              3. -AF is negative TTL signal, AUTOFEED is signal name.
              4. -ST is negative TTL siganl, STROBE is signal name.
              5. NA not applicable.




         PARALLEL Port Addresses   INPUT PORT (Input to computer)


         LPT1: 957     3BD Hex
         LPT2: 889     379 Hex
         LPT3: 633     279 Hex



         �������������������������������������������������������ͻ
         �      �      �      �      �      �      �      �      �
         �      �      �      �      �      �      �      �      �
         � -BUSY�  ACK �  PE  �  SEL �   ?  �  NA  �  NA  �  NA  �
         �      �      �      �      �      �      �      �      �
         �      �      �      �      �      �      �      �      �
         �������������������������������������������������������ͼ


PIN  #     11      10     12     13     15       -      -       -
BIT  #      7       6      5      4      3       -      -       -
VALUE     128      64     32     16      8       -      -       -


         Notes:

              1. ?  signal name unknown.
              2. NA not applicable.
              3. -BUSY is negative TTL signal.




    Example of Negative TTL logic


                PIN  #      6    5     4     3     2
                BIT  #      4    3     2     1     0
                VALUE      16    8     4     2     1


      �����������������������������������������������ͻ
      �     �     �     �     �     �     �     �     �
      �  -  �  -  �  -  �  1  �  0  �  0  �  0  �  0  �  DATA PORT
      �     �     �     �     �     �     �     �     �
      �����������������������������������������������ͼ

                           |     |     |     |     |
                           |     |     |     |     |

                        �����������������������������������������������ͻ
                        �     �     �     �     �     �     �     �     �
            INPUT PORT  �  0  �  0  �  0  �  0  �  0  �  -  �  -  �  -  �
                        �     �     �     �     �     �     �     �     �
                        �����������������������������������������������ͼ

               PIN  #     11     10     12    13    15
               BIT  #      7      6      5     4     3
               VALUE     128     64     32    16     8


         Notes:

             1. A 1 bit in the DATA port causes 2.5 to 5.0 volts
                to appear on the cooresponding pin on the DB25 connector.
                In the example above PIN # 6 is on.

             2. BIT # 7 of the INPUT port has negative TTL logic, where
                2.5 to 5.0 volts on PIN # 11 is logic level zero.  The other
                bits of the INPUT port are normal TTL logic.


/* CLOCKC.C ==> This program runs the binary clock */

#include "conio.h"
#define PORT_HR         634
#define PORT_MIN        632
#define OFF_MIN         0
#define OFF_HRS         0x0b
#define WINK            64  /* bit 7 of minute byte used for seconds */

main()
{
   unsigned char ctr_min, ctr_hr, status, hours, minutes, seconds,
                 hundrds, lastsec, second_on();
   void time(), turn_on(), turn_off();

   /* start by turning off all circuits */

   ctr_min = OFF_MIN;
   ctr_hr = OFF_HRS;

   outp (PORT_HR, ctr_hr);
   outp (PORT_MIN, ctr_min);

   /* the clock will run indefinately */

   for (;;) {

       /* get the time */
       time(&hours, &minutes, &seconds, &hundrds);

       /* the hours require special handling, DOS returns hours in 24  */
       /* hour format. Convert to 12 hr format. Next XOR hours against */
       /* OFF_HRS to get the proper bit pattern for the hours.         */

       ctr_hr = ((hours = hours % 12) ? hours : 12) ^ OFF_HRS;

       /* the minutes are easy, output ASIS */

       ctr_min = minutes;

       /* Display the hours and minutes */

       outp (PORT_HR, ctr_hr);
       outp (PORT_MIN, ctr_min);

       /* wink the seconds, up to the next minute */




       for (lastsec = seconds; seconds <= 59; ) {

           time (&hours, &minutes, &seconds, &hundrds);

           if (lastsec != seconds) { /* seconds has changed */

               lastsec = seconds;

               /* if second is on turn off, else turn on */

               if (!second_on(ctr_min, WINK))

                 turn_on (PORT_MIN, &ctr_min);
               else

                 turn_off (PORT_MIN, &ctr_min);

           }

           /* seconds up to 59, exit loop */

           if (seconds == 59)
               break;


       }
   }

}

unsigned char second_on(control, sec)
unsigned char control, sec;
{
   return (control & sec);

}

void turn_on (port, control)
unsigned char *control;
int port;
{
   *control = *control | WINK;

   outp (port, *control);

}

void turn_off (port, control)
unsigned char *control;
int port;
{
   *control = *control & ~WINK;

   outp (port, *control);

}



/* PORTTST.C -- This program is used to determine if the info  */
/* I have gathered about Input Ports is correct.  The program  */
-end-

--------------44815FF259F8
Content-Type: text/plain; charset=us-ascii; name="Parallel.msg"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Parallel.msg"

From: Trent Wyatt		To: Ed Beroset
Date: 22 Feb 92  23:13:26
Subj: RE: Hardware Questions
Conf: `PC Assembly Language'

Just to put in my two cents worth, on a PC COMPATIBLE! there are actually 6
bidirectional pins available.  I work with some of those electronic software
keys with my work, and thats how you talk to them.  The reason I say
COMPATIBLE is that DELL among a few other, chose to not include the stand pins
that were on the original PC.  Sure they included the pins needed to TALK to
the printer, but they totally blew off the 74LS157's needed to get the stuff
back in...... I have written a few transfer programs that use the parallel
port to get stuff between PC's and have gotten speeds up to 18KB/s...

[Info-IBMPC #101]

Date: Tue, 21 Apr 92 10:06:21 EST
From: francis deck <fdeck@doc.helios.nd.edu>
Subject: Parallel Port Driver info

{
SYSTEM RAM DATA

   Location	Size		Description
   $40:08	4 words		I/O address of up to 4 printer adapters.
   $40:10	1 word		Bits 15-14 = Number of printer adapters.
   $40:78	4 bytes		One byte per adapter.  Time-out values
				for printers 1 through 4.

PARALLEL PRINTER I/O PORTS

   The i/o address found by checking System RAM location $40:08
   is first of a block of three i/o ports, here numbered A+0
   through A+2.

   Port			Description

   A+0			Data output port, bits D0-D7.

   A+1			Status input port, where:

			Bit	Mnemonic
			0-1	Reserved
			2	IRQ has occurred
			3	Error
			4	Select Input
			5	Paper Out
			6	Acknowledge
			7	Busy

   A+2			Control output port, where:

			Bit	Mnemonic
			0	Strobe
			1	Auto Feed
			2	Init Printer
			3	Select
			4	Enable IRQ
			5-7	Reserved

PARALLEL PORT PINOUT

   The parallel port is a female DB25 connector, with the
   following pinout:

	Pin		Mnemonic
	1		Strobe
	2-9		D0-D7
	10		Acknowledge
	11		Busy
	12		Paper Out
	13		Select (input)
	14		Auto Feed
	15		Error
	16		Init Printer
	17		Select (output)
	18-25		Ground

COMMENTS

   Printer port outputs and inputs are simple TTL lines.  For
   high-speed applications, output lines may have to be
   terminated with pull-up resistors at the receiving end.

   I understand that some PCs implement the parallel port with
   an 8255 or some such device, allowing reconfiguration of the
   data direction of the port i/o lines.  I don't do this,
   since some PCs, my Zenith included, use unidirectional port
   chips for all the LPT i/o lines.  For greatest
   compatibility, stick to the data directions listed above!

REFERENCES

   System BIOS for IBM PC/XT/AT computers and compatibles; the
   complete guide to ROM-based system software, Phoenix
   Technologies, Ltd, (Reading Mass.: Addison-Wesley Pub. Co.,
   1989)

   Owner's manual for Zenith Z-148 PC.

{======== Turbo Pascal printer port demp LPTDEMO.PAS =======}

program lptdemo;

var
   ina, outa, ctrla: word; {input, output, control port addresses}

const
     nlpt = 1; {printer port number}
     base: word = $40; {base address in BIOS system RAM}
     offs: array[1..3] of word = ($08,$0A,$0C); {offset in system RAM}

begin
     {This initialization is mandatory}

     outa := memw[base:offs[nlpt]];
     ina := outa + 1;
     ctrla := outa + 2;

     {now, let's play with the ports}

     port[outa] := 1; {set D2 line}
     writeln ('Pin 2 should be TTL HIGH');
     readln;

     port[outa] := 0; {reset D2 line}
     writeln ('Pin 2 should be TTL LOW');
     readln;

     port[ctrla] := 1; {set strobe line}
     writeln ('pin 1 should be TTL HIGH');
     readln;

     port[ctrla] := 0;
     writeln ('pin 1 should be TTL LOW');
     readln;

     {endless loop reading Acknowledge line}

     while true do if port[ina] and 64 <> 0
	   then writeln ('Pin 10 = HIGH')
	   else writeln ('Pin 10 = LOW');

     end.
{-------- Demonstrate IRQ7 handler ---------}

{This program demonstrates the parallel printer interrupt IRQ7, by
 counting transitions on the Acknowledge pin of the printer port.
 I am indebted to Kerry Yackoboski at Univ. of Manitoba for writing
 the interrupt handler--all I did was add the part which turns the
 port's interrupt generator on.

 Francis J. Deck
 fdeck@grumpy.helios.nd.edu
 "Elegance is for tailors!" -- Einstein}

program isrtest;

uses
    crt,
    dos;

const
     pc_imr = $21; {interrupt mask register--which interrupts are
		    active?}

     pc_isr = $20; {interrupt status register--will be used to send
		    an EOI (end of interrupt) command to the 8255
		    interrupt controller}

     irq7 = $0f; {the interrupt number of IRQ7.}
     eoi7 = $60 + 7; {EOI instruction for IRQ7};

var
   imr: byte; {saved value of interrupt mask register}
   count: integer;

{-------- Service routine for IRQ7 --------}

procedure int_7_handler;

interrupt;

begin
     port[pc_imr] := imr; {restore old value of interrupt mask register
			   so subsequent IRQ7's won't happen while this
			   routine is running.}

     count := count + 1;
     writeln ('Interrupt ',count);

     port[pc_isr] := eoi7; {send EOI to 8255 controller.  You gotta send
			   this EOI before re-enabling the interrupt, or
			   a spurious IRQ7 will be generated.}

     port[pc_imr] := port[pc_imr] and $7f; {set mask register again so
					    IRQ7 can happen.}
     end;

{-------- Mainline --------}

const
     nlpt = 1; {printer port number--1, 2, or 3}
     base: word = $40; {base in memory for printer port info}
     offs: array[1..3] of word = ($08,$0A,$0C); {offsets in RAM for info
						 on ports 1, 2, and 3}

var
   ina, outa, ctrla: word; {input, output, control port addresses}

var
   old_int_vec: pointer; {saved value of vector for IRQ7}

begin
     clrscr;
     writeln ('This program demonstrates the use of the parallel printer');
     writeln ('port interrupt IRQ7.  It generates an interrupt every time');
     writeln ('the Acknowledge input of the printer port (pin 10) goes');
     writeln ('from LOW to HIGH.  You can test it at this point by');
     writeln ('repeatedly connecting and disconnecting a jumper wire from');
     writeln ('pin 10 to pin 18 of the port.  The program will terminate');
     writeln ('when you press any key...');
     writeln;
     count := 0;
     port[pc_isr] := eoi7; {send an EOI to clear all pending interrupts}
     getintvec (irq7,old_int_vec); {store away existing value of interrupt
				  vector}
     setintvec (irq7,@int_7_handler); {now, point IRQ7 to our own little
				       routine}
     {find out, from BIOS system RAM, where the printer port is...}
     outa := memw[base:offs[nlpt]]; {data output port}
     ina := outa + 1; {handshake input port}
     ctrla := outa + 2; {handshake output port}
     port[ctrla] := 16; {enable the port to generate IRQ7 upon positive-
			 going transition on Acknowledge pin.}
     imr := port[pc_imr]; {save existing value of interrupt mask}
     port[pc_imr] := port[pc_imr] and $7f; {set 7th. bit of IMR to 1}
     repeat until keypressed; {just loop forever, while the user plays
			       with pin 10}
     port[ctrla] := 0; {disable port's IRQ7 generation}
     port[pc_imr] := imr; {restore IMR}
     port[pc_isr] := eoi7; {send EOI, clearing any further interrupts}
     setintvec ($f,old_int_vec); {restore value of interrupt vector}
     end.

[Info-IBMPC #141]
Date: Thu, 20 Aug 92 10:19:25 EST
From: jeff lewis <JLEWIS%INDYCMS.BITNET@pucc.princeton.edu>
Subject: Bidirectional Parallel Port?

I've been trying to locate information on using the parallel port for
bi-directional data transfers, etc.

I've searched several books without any information other than DOS does
not directly support incoming data from the parallel port.

Can anyone supply information both hardware and/or software examples of
accomplishing this?  The more detailed the information, the better.
I'm planning on making hardware projects that communicate with the
computer through the parallel port (ie. STROBE and DATA bits)

Thanks...   Jeff

------------------------------


Date: Fri, 21 Aug 92 06:23:00 TUR
From: RITTERBUS001@wcsub.ctstateu.edu
Subject: Bidirectional Parallel Port?


>I've been trying to locate information on using the parallel port for
>bi-directional data transfers, etc.

Jeff,

I recall reading an article about 6 months ago in one of Radio
Electronics, Popular Electronics or Computer Craft about exactly how to
read data into the parallel port.  This included construction details
for a hardware interface (in case you want to use it for data
acquisition), as well as the code to perform the read.  I can't recall
the specifics, but one thing I believe I remember was to the effect
that you had to set the "data direction register" on the port to tell
it it was an input instead of an output.

If you can't find the article in a Periodical Guide, send me a note and
I will try to look up the issue for you.

Jim Ritterbusch
Western Connecticut State Univ.
ritterbus001@wcsu.ctstateu.edu

------------------------------

Area: `Technical'	Date:  5 Feb 93
From: Ed Mann		To: Scott Jensen
Subj: Ports

 SJ> I am in need of some port specifications.  I would like info on
 SJ> the pin settings of the game port, serial, (9 & 25 pin), and
 SJ> parallel.

		    CENTRONICS PARALLEL INTERFACE REFERENCE

					___
				      /    |
				    /      |
				  / 	   |
		 Undefined (-)-> | 36	18 | <-(+) Volts (LPT)
		 Undefined (-)-> | 35	17 | <-Chassis Ground (Common)
		 Undefined (-)-> | 34	16 | <-Logic Ground (Common)
		 Undefined (-)-> | 33	15 | <-Oscillator Transmit (LPT)
      Fault (Active LOW) (LPT)-> | 32	14 | <-Supply Ground (Common)
Input Prime (Active LOW) (CPU)-> | 31	13 | <-Select (Active HIGH)(LPT)
 Input Prime - RETURN (Common)-> | 30	12 | <-Paper End (Active HIGH)(LPT)
	Busy - RETURN (Common)-> | 29	11 | <-Busy (Active HIGH)(LPT)
 Acknowledge - RETURN (Common)-> | 28	10 | <-Acknowledge (Active LOW)(LPT)
  Data Bit 8 - RETURN (Common)-> | 27	 9 | <-Data Bit 8  (MSB)(CPU)
  Data Bit 7 - RETURN (Common)-> | 26	 8 | <-Data Bit 7 (CPU)
  Data Bit 6 - RETURN (Common)-> | 25	 7 | <-Data Bit 6 (CPU)
  Data Bit 5 - RETURN (Common)-> | 24	 6 | <-Data Bit 5 (CPU)
  Data Bit 4 - RETURN (Common)-> | 23	 5 | <-Data Bit 4 (CPU)
  Data Bit 3 - RETURN (Common)-> | 22	 4 | <-Data Bit 3 (CPU)
  Data Bit 2 - RETURN (Common)-> | 21	 3 | <-Data Bit 2 (CPU)
  Data Bit 1 - RETURN (Common)-> | 20	 2 | <-Data Bit 1 (CPU)
 Data Strobe - RETURN (Common)-> | 19	 1 | <-Data Strobe (Active LOW)(CPU)
				  \	   |
				    \      |
				      \____|

	       KEY:  Signal Designations (Signal/Voltage Source)

=============================================================================

			IBM PC STYLE PARALLEL INTERFACE
				   DB 25 Pin
				    Numbers

					___
				      /    |
				    /      |
				  /	13 | <-Select (Active High)(LPT)
	Return/Ground (Common)-> | 25	   |
				 |	12 | <-Paper End (Active High)(LPT)
	Return/Ground (Common)-> | 24	   |
				 |	11 | <-Busy (Active High)(LPT)
	Return Ground (Common)-> | 23	   |
				 |	10 | <-Acknowledge (Active Low)(LPT)
	Return Ground (Common)-> | 22	   |
				 |	 9 | <-Data Bit 8 (MSB)(CPU)
	Return Ground (Common)-> | 21	   |
				 |	 8 | <-Data Bit 7 (CPU)
	Return Ground (Common)-> | 20	   |
				 |	 7 | <-Data Bit 6 (CPU)
	Return Ground (Common)-> | 19	   |
				 |	 6 | <-Data Bit 5 (CPU)
	Return Ground (Common)-> | 18	   |
				 |	 5 | <-Data Bit 4 (CPU)
Select Input (Active Low)(CPU)-> | 17	   |
       Initialize Printer	 |	 4 | <-Data Bit 3 (CPU)
       (Prime-Active Low)(CPU)-> | 16	   |
				 |	 3 | <-Data Bit 2 (CPU)
 Error (Fault-Active Low)(LPT)-> | 15	   |
				 |	 2 | <-Data Bit 1 (CPU)
   Auto Line Feed (Active Low)-> | 14	   |
			 (CPU)    \	 1 | <-Data Strobe (Active Low)(CPU)
				    \      |
				      \____|

	       KEY:  Signal Designations (Signal/Voltage Source)

==============================================================================

		       IBM/AT STYLE RS-232 INTERFACE
				 DB 9 Pin
				  Numbers

				      ____
				    /	  |
				  /	  |

				/	1 | <-(DCD) Data Carrier Detect(DCE)
   Data Set Ready (DSR)(DCE)-> |  6	  |
			       |	2 | <-(RD) Received Data (DCE)
  Request To Send (RTS)(DTE)-> |  7	  |
			       |	3 | <-(TD) Transmitted Data (DTE)
    Clear To Send (CTS)(DCE)-> |  8	  |
			       |	4 | <-(DTR) Data Terminal Ready(DTE)
    Ring Indicator (RI)(DCE)-> |  9	  |
				\	5 | <-Signal Ground (Common Return)
				  \ 	  |   (Common)
				    \ ____|

	     KEY:  Signal Designations (Signal/Voltage Source)

Area: `PC Assembly Language'	Date: 11 May 93
From: Jason Dombrowski		To: Sean Ebert
Subj: Re: Parallel Port Access

the parallel port is a 2 wa device, with no 'baud rate' per se'..

    most parallel ports can send 800,000 bits per second.. or roughly 100K..

the problem of coding a parallel communication program are as follows:

	 1) no interrupts are triggered when a byte enters the port
	 2) the *programmer* must take care not to flood the port,
	     because there is no modem or other such hardware doing
	     that work for you..
	 3) the recieving machine MUST be dedicated to the task of recieving
	     if speed of such a high rate (100K/sec) is being used, because
	     there is NO way to 'buffer' the data comming into the port..

-!- Renegade v04-16 Beta
 ! Origin: Lost Horizon BBS * ZyXEL 16.8k [v.32bis/v.42bis] * (1:142/888)

Area: `Dr. Debug Conference'	Date: 06 Oct 93
From: Richard Browne		To: James Schumacher
Subj: Re: PARALLEL PORT

JS>It seems as though somewhere I saw something about using the signals
JS>to the parallel port to control things. You would have a program
JS>that would let you send a signal to any of the parallel lines and
JS>then you would have a 'black box' that would decode the signals and
JS>amplify the voltage to drive a relay. Anyone know anything about a
JS>system like this??? Thanks in advance....

James:
I read a reply to this post mentioning the HAL catalog.  A couple of
others are:
Personal Computing Tools.  1-800-767-6728   and
Black Box Catalog	   1-800-552-6816.

I got the impression, however, that you were looking for ways to
experiment yourself.  I use a Pascal program which drives a stepper
motor which drives a turntable.  We use it for jewelry display.  It's
fairly simple to do.  In Pascal, the important commands are:

Var
   P1Address : Word Absolute $0040:$0008; {This gets the LPT1 parallel
					   port address, which isn't
					   always the same.  I believe,
					   for instance, that the LPT1
					   address in a PS-2 is
					   different from in a clone.

   P2Address : Word Absolute $0040:$000A; {In case you wanted to use
					   LPT2}


On my computer, LPT1 is at 378, and LPT2 is at 278.

port(P1Address) := $xx; {causes the eight data lines (pins 2-9 on the
			25 pin connector) to go high or low, depending
			on the value of "xx".

The "$" in Pascal denotes Hex.  Various Hex numbers sent to the parallel
port would have the following results:

Data line:    7  6  5  4  3  2  1  0
$00	      0  0  0  0  0  0  0  0
$11	      0  0  0  1  0  0  0  1
$CC	      1  1  0  0  1  1  0  0
$FF	      1  1  1  1  1  1  1  1

As you can see, any combination of highs and lows is possible.  The pins
are TTL logic, so you would see +5V on the pins for a "1" and 0V
(actually, <0.5V) for a "0".  There isn't enough power to safely drive a
relay, but it will light a LED in series with a 1 Kohm resistor, or
turn on a power transistor, which, in turn, could drive a relay.

To input data from the parallel data lines:
declare a variable:
var
   StateOfPort : byte;
then in your program:
   StateOfPort := port(P1Address);
will return a hex number corresponding to the present state (high or
low) of the data lines.


In basic, you would set a variable equal to the LPT1 address:
A = &H378
(&H, I believe, denotes a hex number)

Then use the OUT command:
OUT A, &Hxx

The BASIC command:
PRINT HEX$(INP A)
will print out a number corresponding to the state of the data
lines.

If you need any further information, answer back, and I'll do what I
can.
-!- TBBS v2.1/NM
 ! Origin: Del Ches Systems BBS - Exton,PA 215-363-6625 Since 1983 (1:273/323)

Area: `Dr. Debug Conference'	Date: 06 Oct 93
From: Brice Fleckenstein	To: James Schumacher
Subj: PARALLEL PORT

>It seems as though somewhere I saw something about using the signals to the
>parallel port to control things.

See almost ANY issue of Ciarcia's Circuit Cellar Ink magazine for examples.
 A TTL parallel port "bit" will easily drive a solid-state relay, and there are
also "regular" relays designed to be driven from a TTL signal.


--------------44815FF259F8--
Technical Details
Message-ID: <35A23A67.5586@NOcarolinaSPAM.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MPG.100bed32f8a54c64989688@news.tic.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10f6aa,34a91f6fb388899
X-Google-Attributes: gid10f6aa,public
X-Google-Thread: 10f688,34a91f6fb388899
X-Google-Attributes: gid10f688,public
X-Google-Thread: 107cbb,34a91f6fb388899
X-Google-Attributes: gid107cbb,public
X-Google-Thread: fafa5,34a91f6fb388899
X-Google-Attributes: gidfafa5,public
X-Google-Thread: fc546,34a91f6fb388899
X-Google-Attributes: gidfc546,public
X-Google-Thread: 1004fc,34a91f6fb388899
X-Google-Attributes: gid1004fc,public
X-Google-Thread: f71eb,34a91f6fb388899
X-Google-Attributes: gidf71eb,public
X-Google-Thread: f78f1,34a91f6fb388899
X-Google-Attributes: gidf78f1,public
From: David Kirschbaum <kirschd@NOcarolinaSPAM.net>
Subject: Re: parallel-port pin layout
Date: 1998/07/07
Message-ID: <35A23A67.5586@NOcarolinaSPAM.net>
X-Deja-AN: 369323504
References: <MPG.100bed32f8a54c64989688@news.tic.ch>
Content-Type: multipart/mixed; boundary="------------44815FF259F8"
Organization: Toad Hall
MIME-Version: 1.0
Newsgroups: comp.os.msdos.4dos,comp.os.msdos.apps,comp.os.msdos.misc,comp.os.msdos.programmer,fido.ger.4dos,fr.comp.os.msdos,it.comp.dos,microsoft.public.basic.dos