Board index » delphi » LPt port componenet for input signals?

LPt port componenet for input signals?

Does someone know a way to get the inputs of a lpt ?
 

Re:LPt port componenet for input signals?


Quote
Arnold Douma wrote:

> Does someone know a way to get the inputs of a lpt ?

If you want to send / recieve data from the ports then following
functions work for Delphi 3(and higher), and they work directly with
Win95/98.
(These will not work directly on NT/W2K/XP, unless a driver is
installed)

function PortIn(IOport:word):byte; assembler;
asm
  mov dx,ax
  in al,dx
end;

function PortInW(IOport:word):word; assembler;
asm
  mov dx,ax
  in ax,dx
end;

procedure PortOut(IOport:word; Value:byte); assembler;
asm
  xchg ax,dx
  out dx,al
end;

procedure PortOutW(IOport:word; Value:word); assembler;
asm
  xchg ax,dx
  out dx,ax
end

{ Example use }
PROCEDURE TMainWin.Command(val:BYTE);
VAR Delay,num:INTEGER;
BEGIN
   PortOut(Port,Val);
   FOR Delay:= 1 TO 500 DO;
   PortOut(Port+2,7);
   FOR Delay:= 1 TO 500 DO;
   num:= PortIn(Port+1) AND $32;
   ShowMessage('Value read = '+IntToStr(num))
END;

I have an example D3 program and code, that uses the above, on my home
page at:
http://www.gu.edu.au/school/eng/mmt/PortDev.ZIP

If you want to use NT then a driver is needed.  You could write your own
or use an exisiting one.

Some examples are:
TVicHW32, http://www.entechtaiwan.com/tools.htm
Tinyport, http://www.winsite.com/info/pc/winnt/programr/tinypo20.zip
DriverX,  http://www.tetradyne.com
Ports, by Harold Howe, http://www.bcbdev.com/components.htm
TDLPortIO, from DiskDude http://diskdude.cjb.net/
GiveIO,  http://www.wideman-one.com/gw/tech/Delphi/iopm/index.htm
or
http://www.geocities.com/tetasoft/
http://www.tetradyne.com/driverx.htm
http://www.entechtaiwan.com/tools.htm
http://www.cmkrnl.com/arc-totalio.html
http://www.beyondlogic.org/porttalk/porttalk.htm
http://www.direct-io.com/

For a more informative discussion goto:
http://www.efg2.com/Lab/Library/Delphi/IO/PortIO.htm

Discussion of Port I/O under NT:
http://users.skynet.be/k-net/ParPort/index.html
http://www.bcbdev.com/faqs/faq30.htm

--
Charles Hacker
Lecturer in Electronics and Computing
School of Engineering
Griffith University - Gold Coast
Australia

Other Threads