Board index » delphi » HELP - Reading from parallel port

HELP - Reading from parallel port

Hi all,

Can anyone help - i am having trouble reading data in from the parallel
port. I can write to it ok. I am using the "port" command with absolute
addressing.
If I write to the port and then read from it I can onle see the last written
byte - When I pull the lines high and low manually the pgm doesnt see it..

Any comments will be appreciated..

John

 

Re:HELP - Reading from parallel port


On 15 Jan 1996, John Atkinson wrote:

Quote
> Hi all,

> Can anyone help - i am having trouble reading data in from the parallel
> port. I can write to it ok. I am using the "port" command with absolute
> addressing.
> If I write to the port and then read from it I can onle see the last written
> byte - When I pull the lines high and low manually the pgm doesnt see it..

> Any comments will be appreciated..

> John

My technical reference manual says that when you try to read the input
data, it will give you the input data OR the last output data.  So you
need to 0 the output before you try to input.  Output 0 to address $378
before you try the input and you <should> :) have better results.  Let me
know how it turns out--I've never done it before but I may sometime in
the near future.

=============================================================
Douglas Cook, undergraduate in Computer Science at BYU
-------------------------------------------------------------
*REAL* programmers use COPY CON PROGRAM.EXE
=============================================================

Re:HELP - Reading from parallel port


On 16 Jan 96 (07:39), atkin...@iafrica.com wrote:

Quote
> Hi all,

> Can anyone help - i am having trouble reading data in from the parallel
> port. I can write to it ok. I am using the "port" command with absolute
> addressing.
> If I write to the port and then read from it I can onle see the last written
> byte - When I pull the lines high and low manually the pgm doesnt see it..

Ummm, this behaviour is a bit funny.... are you sure you are having
a bidirectional parallel port ?? Older parallel ports were designed
to be write-only, but some newer computers seem to have bidirectional
port line drivers. The Centronics standart still defines the parallel
port data line register to be write-only, while the status line register
is read-only.

Normally trying to read from a write-only parallel port should lead
to undefined results, but if you're recieving the last sent byte, this
is really interesting....

Quote

> Any comments will be appreciated..

> John

Stephan

-------------------------------------------------------------------------
 Stephan A. Maciej   step...@maciej.muc.de   http://www.muc.de/~stephanm
       <<< Bug is a registered trademark of Microsoft Corp. >>>
-------------------------------------------------------------------------

Re:HELP - Reading from parallel port


In article <4dd0bf$...@grovel.iafrica.com>,
   atkin...@iafrica.com (John Atkinson) wrote:

Quote
>Hi all,
Hi!
>Can anyone help - i am having trouble reading data in from the parallel
>port. I can write to it ok. I am using the "port" command with absolute
>addressing.
>If I write to the port and then read from it I can onle see the last written
>byte - When I pull the lines high and low manually the pgm doesnt see it..

Umm, I'm not too sure, but most printer ports are one way only.
Only the latest generation of PC:s have bidirectional ports, and they can
usually be configured in the initial setup.

The information you read is in the buffer for the printer port and since your
port probably is unidirectional, any external changes of the port won't show.

However, there are two solutions that I know of:
1: There are five ingoing pins on a printer port (paper out, busy etc),
if all you need is 5 bits or less, then you can utilize these instead.
I can't remember the exact portnumber for this one, but I think it will be
a bit above the write port (1-8 above adresswise)

2: Buy a new parallell port with the ability to talk in both directions,
I have not tried one of these, but I assume they use the standard port for
incoming data...

If you _have_ a bidirectional port, well then I guess I'm a bit at a loss. ;)

 Greetings types Jonas Eriksson, PC systems guru, Photoshopper and roleplayer.
/----------- Thought of the day ---------------------------------------------\
|   "For every action, there is an equal but opposite critical analysis."    |
\-------------------------------------------------- Solomon Short -----------/
Mail:jo...@pinus.slu.se                 Talk:Gladly, if i am online that is...
Tel:018-300870          http://jeriksson.lpul.slu.se/jonas/jonas.htm (when up)

Other Threads