Board index » delphi » parallel port for data acquisition

parallel port for data acquisition

I have two DOS PC's with their parallel ports connected with a Belkin F3D508
cable.

When I run Laplink Pro 4.00 they talk to each other just fine.  Both PC's are
set up for the parallel port at $378 (I confirmed this by looking at the
settings in Laplink).

However, when I run PARX (parallel transmit) on one PC and PARR (parallel
receive) on the other (see code below), it doesn't work.  By "doesn't work" I
mean that the value for 'b' displayed by the receiving PC doesn't change. I
can't see what I'm doing wrong.  Any help would be appreciated.

-------------begin PARX.PAS-------------

uses crt;

var
b:byte;
l:longint;

begin

l:=0;

repeat
  inc(l); inc(b);
  port[$378]:=b;       {transmit the byte}
  write(#13,b:4,l:12); {status display}
  delay(200);
until keypressed;

end.

---------end PARX.PAS------------

--------begin PARR.PAS--------------

uses crt;

var
b:byte;
l:longint;

begin

l:=0;

repeat
  inc(l);
  b:=port[$378];  {read the parallel port at $378}
  write(#13,b:4,l:12);  {display the data}
until keypressed;

end.

------end PARR.PAS---------------

 

Re:parallel port for data acquisition


I haven't programmed the parralell port yet but I did program the serial
port. COM

Anyway in doing that there is something like initializing the port!
So maybe you must first open and setup the ports?

Chaou
Heinrich

Check my web-site:
http://homes.arealcity.com/Heinrichshomepage/
Includes a complete TP tutoriul and more!

Re:parallel port for data acquisition


Hi!

Some time ago I programmed some similar stuff. I used some digital I/O-cards to
do the communication. I'm not sure if this is really comparable to yours using
the parallel port. I never programmed this port. So the cue with my program was,
that the adress (like yours $378) is the base adress. I thinks you need this
adress plus the correct offset to put your data (b) in. Moreover you will have to
initialize the parallel port in order to use it. Even this will be done using the
base adress plus offset. Just take a look at a hardware programming book or try
some routines for the parallel port. You will find several in the TP-pages on the
net.

All the best,
Hans Joerg

Quote
labt...@electrex.de wrote:
> I have two DOS PC's with their parallel ports connected with a Belkin F3D508
> cable.

> When I run Laplink Pro 4.00 they talk to each other just fine.  Both PC's are
> set up for the parallel port at $378 (I confirmed this by looking at the
> settings in Laplink).

> However, when I run PARX (parallel transmit) on one PC and PARR (parallel
> receive) on the other (see code below), it doesn't work.  By "doesn't work" I
> mean that the value for 'b' displayed by the receiving PC doesn't change. I
> can't see what I'm doing wrong.  Any help would be appreciated.

> -------------begin PARX.PAS-------------

> uses crt;

> var
> b:byte;
> l:longint;

> begin

> l:=0;

> repeat
>   inc(l); inc(b);
>   port[$378]:=b;       {transmit the byte}
>   write(#13,b:4,l:12); {status display}
>   delay(200);
> until keypressed;

> end.

> ---------end PARX.PAS------------

> --------begin PARR.PAS--------------

> uses crt;

> var
> b:byte;
> l:longint;

> begin

> l:=0;

> repeat
>   inc(l);
>   b:=port[$378];  {read the parallel port at $378}
>   write(#13,b:4,l:12);  {display the data}
> until keypressed;

> end.

> ------end PARR.PAS---------------

Other Threads