Board index » delphi » Help with (Parallel) Port access in Delphi..

Help with (Parallel) Port access in Delphi..

Help..

I have a writtain a Turbo Pascal (DOS) application in which
I use a parallel port as a general purpose interface to
send/gather data from (external) sensors.

I have started to convert this into a Delphi 1.0 programme but
Delphi (or windows 3.1) doesn't like direct port access's.

Do you have any clues as to how I can achieve read/writes to
the ports under Delphi?

regards
--
Nick Porter

 

Re:Help with (Parallel) Port access in Delphi..


Quote
Nick Porter wrote:

> Help..

> I have a writtain a Turbo Pascal (DOS) application in which
> I use a parallel port as a general purpose interface to
> send/gather data from (external) sensors.

> I have started to convert this into a Delphi 1.0 programme but
> Delphi (or windows 3.1) doesn't like direct port access's.

> Do you have any clues as to how I can achieve read/writes to
> the ports under Delphi?

> regards
> --
> Nick Porter

The easiest way would be to use the inline
assembler.  This example probably won't compile,
but the jist is there...

function LPTIn(SourcePort: Integer): Integer;
asm
  LDA SourcePort
  INP AX
end;

function LPTOut(DestPort, Value: Integer): Integer;
asm
  LDA  DestPort
  OUTP AX, Value
end;

The return value is in AX.  Note: This won't work
in WinNT or Win 95?

Other Threads