RE: PC's as Controllers

 BBS: Inland Empire Archive
Date: 07-04-92 (13:31)             Number: 2176
From: STEVE CRAVER                 Refer#: NONE
  To: MAX VAUGHAN                   Recvd: NO  
Subj: RE: PC's as Controllers        Conf: (2) Quik_Bas
MV->All I had to do on my particular card was to cut the ground connection
MV->on pin #1 of the 74ls374 and hook it up on pin 15 of the 74ls174
MV->which is normally was already in existance. Now my question is how do
MV->I READ from this port?

The port is bit-mapped. From what you are saying, this must
be an older type of parallel card, since most of the newer
ones no longer support that trick.
The newer ones don't use the 174 and 175's.

MV->the data lines high or do I pull them low to get the data on the
MV->port.

99% of all TTL lines are active LOW, meaning the external connections rarely
need to generate a voltage. All they need to do is supply a ground.
Ok gang, here it is in a nutshell:

FOR THE I/O TYPE OF PORT, you must first set bit 5 at lpt.address + 2:
OUT (LPT.Address + 2), 32 ' <---32 sets bit 5
That tells the port to accept data, then read the word:
x = INP(LPT.Address)
x will be from 0 to 255, representing the bit status of the 8 data lines.
Remember to reset bit 5 if you wish to output any data:
OUT (LPT.Address + 2), 0

TO READ A STANDARD PORT, you must "fool" the system. The
output data lines of the port are of open collector type,
meaning you cannot damage anything by shorting any or all
of the pins (there is NO active +5v supply lines on the
parallel port). Knowing this, when you want to READ a
status, you must first set all of the lines high:
OUT (LPT.Address), 255
The port retains the registers upon writing, so now that
all lines are high, have your application supply a ground
to the appropriate pins. Then, turn right around and READ
the port..
x = INP(LPT.Address)
x will be from 0 to 255
*** NOTICE ***
Since these type of ports were not meant for input, and by
the simple fact that they are open collector, a simple TTL
"lo", such as the output of a buffer, etc., cannot sink
enough current to change the registers. You must either
supply a dry contact (relay?), or use a transistor
(2N2222). The output of a TTL application can feed the base
of the 2N2222, its' emitter tied to ground (pin 15-25 of
the parallel port), and its' collector tied to the
appropriate data line.

Both of these configurations have been tested and used by
me. As I said in an earlier message, I've been
experimenting with the port for about a year now. If I can
help any further, let me know.
Steve

--- DB B1073/071082
 * Origin: RadioLink! Columbus, OH (614)766-2162 HST/DS (1:226/140)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET