Link to home
Start Free TrialLog in
Avatar of anas_madani
anas_madani

asked on

Connection via LPT

Where can I find components that makes me manage data IN/OUT the Parallel port ,
I also need full informations about how does the LPT work

Thanks for help
anas
Avatar of Fatman121898
Fatman121898

Hi, anas.
You have no need of any Delphi components in order to work with LPT. For every LPT there are three IO addresses (Ports) which are: Data port, Status port and Control port. They are as follows:
 
for LPT1:
$378 - Data port (Read/Write)
$379 - Status port (Read)
$37a - Control port (Read/Write)

for LPT2:
$278 - Data port (Read/Write)
$279 - Status port (Read)
$27a - Control port (Read/Write)
.

If you are using Delphi1 or Delphi2 you should use code like this:

Port[xxx]:=SomeValue;   //  in order to write SomeValue to IO port #xxx
SomeVar:=Port[xxx];      //  in order to read IO port #xxx into SomeVar
.

If  you are using any 32 bit Delphi (Delphi 3 or Delphi 4) you should use this:

// to write SomeValue to IO port #xxx:
asm
  mov DX, xxx;
  mov AL, SomeVal;
  out DX, AL;
end;
.
// to read port #xxx into SomeVar:
asm
  mov DX, xxx;
  in AL, DX;
  mov SomeVar, AL;
end;
.
Where: xxx : IO port number
           SomeValue: Byte type value;
           SomeVar:     Any Integer type variable;

NOTES:
1.All this stuff will not work if your OS is WindowsNT, because it doesn't allow direct access to such resources as IO ports.
2.The meaning of every bit in Status and Control port is fully described in literature.  


Avatar of anas_madani

ASKER

Hi  Fatman

You have mentioned my problem in your NOTES   ( Yes I'm working with WINDOWS NT4)

I do work with DELPHI 3
there's a good component called tvichw32 probably here
also one called tserial i think that does nt lpt ports
http://sunsite.icm.edu.pl/delphi/
or
 www.torry.ru/

comes with good examples etc and is fine for nt
(it maybe shareware cant remember)
Regards Barry

Hi Anas nice to see you here, I'm interested in your quesion, so I'll check for notification.

Motaz A. Azim
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial